結果
問題 | No.1631 Sorting Integers (Multiple of K) Easy |
ユーザー | 👑 ygussany |
提出日時 | 2021-07-30 21:12:34 |
言語 | C (gcc 12.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 789 bytes |
コンパイル時間 | 1,298 ms |
コンパイル使用メモリ | 28,964 KB |
実行使用メモリ | 8,704 KB |
最終ジャッジ日時 | 2023-10-14 02:39:24 |
合計ジャッジ時間 | 6,226 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,956 KB |
testcase_01 | AC | 1 ms
4,352 KB |
testcase_02 | AC | 0 ms
4,352 KB |
testcase_03 | AC | 22 ms
4,348 KB |
testcase_04 | AC | 1 ms
4,348 KB |
testcase_05 | AC | 1 ms
4,348 KB |
testcase_06 | AC | 1 ms
4,352 KB |
testcase_07 | AC | 1 ms
4,352 KB |
testcase_08 | AC | 1 ms
4,348 KB |
testcase_09 | AC | 1 ms
4,352 KB |
testcase_10 | AC | 1 ms
4,348 KB |
testcase_11 | AC | 0 ms
4,348 KB |
testcase_12 | AC | 0 ms
4,348 KB |
testcase_13 | AC | 0 ms
4,352 KB |
testcase_14 | TLE | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
コンパイルメッセージ
main.c: 関数 ‘next_integer’ 内: main.c:5:16: 警告: 型がデフォルトの ‘int’ に ‘c’ の宣言内でなります [-Wimplicit-int] 5 | static c[10] = {}; | ^
ソースコード
#include <stdio.h> long long next_integer(int N, long long X) { static c[10] = {}; int i = X % 10, j = X / 10 % 10; c[i]++; while (i <= j) { X /= 10; c[j]++; i = j; j = X / 10 % 10; } if (j == 0) return 0; X /= 100; c[j]++; for (i = j + 1; c[i] == 0; i++); X = X * 10 + i; c[i]--; for (i = 1; i <= 9; i++) { for (j = 1; j <= c[i]; j++) X = X * 10 + i; c[i] = 0; } return X; } int main() { int i, j, N, K, c[10], ans = 0; long long X; scanf("%d %d", &N, &K); for (i = 1, c[0] = 0; i <= 9; i++) scanf("%d", &(c[i])); for (i = 1, X = 0; i <= 9; i++) { for (j = 1; j <= c[i]; j++) X = X * 10 + i; c[i] = 0; } do { fflush(stdout); if (X % K == 0) ans++; X = next_integer(N, X); } while (X > 0); printf("%d\n", ans); fflush(stdout); return 0; }