diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2017-11-17 23:20:22 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2017-11-17 23:20:22 +0100 |
commit | 0dd06afc9d919783c00566ebd2e6ea33f2e2bfb8 (patch) | |
tree | 546945cb0cd6ccb5e793481b16db390bbc42be15 | |
parent | 50403b14f689f5f7a3a65aeb7b9e125653fb4168 (diff) | |
download | AceptaElReto-0dd06afc9d919783c00566ebd2e6ea33f2e2bfb8.tar.gz AceptaElReto-0dd06afc9d919783c00566ebd2e6ea33f2e2bfb8.zip |
Problema397 con hermoso RTE (por tiempo de ejecuciĆ³n).
-rw-r--r-- | AceptaElReto/src/Problema397.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/AceptaElReto/src/Problema397.java b/AceptaElReto/src/Problema397.java new file mode 100644 index 0000000..84945ac --- /dev/null +++ b/AceptaElReto/src/Problema397.java @@ -0,0 +1,22 @@ +
+public class Problema397 {
+
+ public static void main(String[] args) {
+ Integer input;
+ int counter = 0;
+ String iString;
+
+ for ( String arg: args ) {
+ input = Integer.valueOf(arg);
+ counter = 0;
+ for ( Integer i = 1 ; i <= input; i++ ) {
+ iString = i.toString();
+ for ( int j = 0; j < iString.length(); j++ ) {
+ counter += Integer.valueOf(String.valueOf(iString.charAt(j)));
+ }
+ }
+ System.out.println(counter);
+ }
+ }
+
+}
|