結果
問題 | No.1168 Digit Sum Sequence |
ユーザー | GafoGafo |
提出日時 | 2021-02-25 15:57:48 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,242 bytes |
コンパイル時間 | 642 ms |
コンパイル使用メモリ | 29,392 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-01 06:42:19 |
合計ジャッジ時間 | 1,612 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,816 KB |
testcase_02 | AC | 1 ms
6,820 KB |
testcase_03 | AC | 1 ms
6,820 KB |
testcase_04 | AC | 1 ms
6,820 KB |
testcase_05 | AC | 1 ms
6,816 KB |
testcase_06 | AC | 1 ms
6,816 KB |
testcase_07 | AC | 1 ms
6,820 KB |
testcase_08 | AC | 1 ms
6,820 KB |
testcase_09 | AC | 1 ms
6,816 KB |
testcase_10 | AC | 1 ms
6,820 KB |
testcase_11 | AC | 1 ms
6,820 KB |
testcase_12 | AC | 1 ms
6,816 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 1 ms
6,820 KB |
testcase_18 | AC | 1 ms
6,820 KB |
testcase_19 | AC | 1 ms
6,820 KB |
testcase_20 | AC | 1 ms
6,816 KB |
testcase_21 | AC | 1 ms
6,816 KB |
testcase_22 | AC | 1 ms
6,816 KB |
testcase_23 | AC | 1 ms
6,816 KB |
testcase_24 | AC | 1 ms
6,816 KB |
testcase_25 | AC | 1 ms
6,820 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 1 ms
6,820 KB |
testcase_30 | AC | 1 ms
6,816 KB |
ソースコード
#include <stdio.h> int main() { int num; int box = 0; int i; scanf("%d", &num); if((0 <= num ) && (num < 10)) { printf("%d\n", num); return 0; } else if((10 <= num ) && (num < 100)) { box = (num / 10); box = box + (num % 10); box = (box / 10) + (box % 10); printf("%d\n", box); return 0; } else if((100 <= num) && (num < 1000)) { box = (num / 100); box = box + ((num % 100) / 10); box = box + (num % 10); box = (box / 10) + (box % 10); printf("%d\n", box); return 0; } else if((1000 <= num) && (num < 10000)) { box = num / 1000; box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); box = (box / 10) + (box % 10); printf("%d\n", box); return 0; } else if((10000 <= num) && (num < 100000)) { box = num / 10000; box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); box = (box / 10) + (box % 10); printf("%d\n", box); return 0; } else if((100000 <= num) && (num < 1000000)) { box = num / 100000; box = box + ((num % 100000) / 10000); box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); box = (box / 10) + (box % 10); printf("%d\n", box); return 0; } else if((1000000 <= num) && (num < 10000000)) { box = num / 1000000; box = box + ((num % 1000000) / 100000); box = box + ((num % 100000) / 10000); box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); box = (box / 10) + (box % 10); printf("%d\n", box); return 0; } else if((10000000 <= num) && (num < 100000000)) { box = num / 10000000; box = box + ((num % 10000000) / 1000000); box = box + ((num % 1000000) / 100000); box = box + ((num % 100000) / 10000); box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); box = (box / 10) + (box % 10); printf("%d\n", box); return 0; } else if((100000000 <= num) && (num < 1000000000)) { box = num / 100000000; box = box + ((num % 100000000) / 10000000); box = box + ((num % 10000000) / 1000000); box = box + ((num % 1000000) / 100000); box = box + ((num % 100000) / 10000); box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + ((num % 10)); box = (box / 10) + (box % 10); printf("%d\n", box); return 0; } else if((1000000000 <= num) && (num < 10000000000)) { box = num / 1000000000; box = box + ((num % 1000000000) / 100000000); box = box + ((num % 100000000) / 10000000); box = box + ((num % 10000000) / 1000000); box = box + ((num % 1000000) / 100000); box = box + ((num % 100000) / 10000); box = box + ((num % 10000) / 1000); box = box + ((num % 1000) / 100); box = box + ((num % 100) / 10); box = box + (num % 10); box = (box / 10) + (box % 10); box = (box / 10) + (box % 10); box = (box / 10) + (box % 10); box = (box / 10) + (box % 10); box = (box / 10) + (box % 10); box = (box / 10) + (box % 10); printf("%d\n", box); return 0; } return 0; }