Submit | All submissions | Best solutions | Back to list |
FACT_FUN - H Function |
Wersja polska | English version |
Funkcję H(x) definiuje się poprzez sumę wszystkich cyfr liczby naturalnej x. Co więcej, jeśli H(x)>9 to
H(x)=H(H(x)).
Wejście
W pierwszej linii wejścia znajduje się liczba testów t (t<100001).
Każdej z t linii zawiera liczbę x (x<106).
Wyjście
Dla każdego testu wypisz H(x!).
Przykład
Wejście: 2
1
5
Wyjście: 1
3
Added by: | Piotr Kąkol |
Date: | 2011-09-11 |
Time limit: | 5s-10s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: SCM qobi |
Resource: | Copy of HFUN with bigger time limit and all available languages |
hide comments
|
|||||
2014-02-27 03:22:27 Mitch Schwartz
Oh I forgot about that. I also had modified my BF program to pass there before noticing it wasn't allowed (a few months ago). :( Last edit: 2014-02-27 06:19:10 |
|||||
2014-02-25 23:18:10 Piotr KÄ…kol
Unfortunately, Bash is not allowed in HFUN. |
|||||
2014-02-25 17:34:50 Mitch Schwartz
@Sebastian Jakubiak: If your 28-byte bash solution works with "\r\n" newlines, you could take top spot in HFUN. :) |
|||||
2013-11-25 03:46:25 Linghui Liu
@Piotr Kąkol,@Mitch Schwartz Thank you. I made a silly mistake. I note that submitting file is always one more byte than source editing since the system will append '\n'. Last edit: 2013-11-25 04:12:26 |
|||||
2013-11-24 16:53:30 Piotr KÄ…kol
In HFUN you probably have two additional endlines at the end of your code. As for SED, you don't read the number of tests. The Levensthein distance from your code to a valid code equals 3. ;-) |
|||||
2013-11-23 23:36:51 Mitch Schwartz
@Linghui Liu: I believe the standard judge is being used for both problems, and the score is precisely your source length. Maybe there is some extra whitespace in your 41-byte code; you could also experiment with submitting a file instead of copying and pasting into the text box. |
|||||
2013-11-23 15:32:04 Linghui Liu
Oddly,for same awk code here 39, but HFUN 41. And I don't know why the 29-byte sed code WA, I tested all small cases. |
|||||
2013-09-12 20:16:35 Jander
Thank you for the hint Mitch - indeed \r\n seems to be the issue with HFUN. Shame that you beat me to it ;-) |
|||||
2013-09-12 19:45:51 Mitch Schwartz
Haha. :) HFUN has "\r\n" newlines, I'm sure that's the reason. |
|||||
2013-09-12 19:42:07 Jander
Snigger :-) Oddly, this sed answer doesn't work for HFUN. |