結果
問題 | No.443 GCD of Permutation |
ユーザー | olphe |
提出日時 | 2016-11-12 00:10:24 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,512 bytes |
コンパイル時間 | 498 ms |
コンパイル使用メモリ | 55,952 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-05-04 03:53:50 |
合計ジャッジ時間 | 1,528 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,944 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | WA | - |
testcase_12 | AC | 2 ms
6,944 KB |
testcase_13 | AC | 2 ms
6,944 KB |
testcase_14 | AC | 2 ms
6,944 KB |
testcase_15 | AC | 2 ms
6,940 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | AC | 2 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,944 KB |
testcase_19 | AC | 2 ms
6,940 KB |
testcase_20 | AC | 2 ms
6,940 KB |
testcase_21 | AC | 2 ms
6,944 KB |
testcase_22 | WA | - |
testcase_23 | AC | 2 ms
6,944 KB |
testcase_24 | WA | - |
testcase_25 | AC | 2 ms
6,940 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 2 ms
6,944 KB |
testcase_29 | WA | - |
testcase_30 | AC | 2 ms
6,944 KB |
testcase_31 | WA | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:20:31: warning: NULL used in arithmetic [-Wpointer-arith] 20 | if (num[i] == NULL) { | ^~~~ main.cpp:30:34: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null] 30 | num[i] = NULL; | ^~~~ main.cpp:34:31: warning: NULL used in arithmetic [-Wpointer-arith] 34 | if (num[i] == NULL) { | ^~~~ main.cpp:41:31: warning: NULL used in arithmetic [-Wpointer-arith] 41 | if (num[i] == NULL) { | ^~~~ main.cpp:50:39: warning: NULL used in arithmetic [-Wpointer-arith] 50 | if (num[i] == NULL) { | ^~~~ main.cpp:60:39: warning: NULL used in arithmetic [-Wpointer-arith] 60 | if (num[i] == NULL) { | ^~~~ main.cpp:69:31: warning: NULL used in arithmetic [-Wpointer-arith] 69 | if (num[i] == NULL) { | ^~~~ main.cpp:77:31: warning: NULL used in arithmetic [-Wpointer-arith] 77 | if (num[i] == NULL) { | ^~~~ main.cpp:85:31: warning: NULL used in arithmetic [-Wpointer-arith] 85 | if (num[i] == NULL)break; | ^~~~
ソースコード
#include "iostream" using namespace std; char num[10004]; int base; int start = 0; int sum=0; long long int ans=1; bool flag=true; int far = 0; int main() { cin >> num; for (int i = 0;; i++) { if (num[i] != '0') { base = num[i]; start = i; break; } if (num[i] == NULL) { cout << 1<<"\n"; return 0; } } if (start != 0) { for (int i = 0; i < 10000 - start; i++) { num[i] = num[i + start]; } for (int i = 10000 - start; i < 10000; i++) { num[i] = NULL; } } for (int i = 0;; i++) { if (num[i] == NULL) { cout << num<<"\n"; return 0; } if (num[i] != base)break; } for (int i = 0;; i++) { if (num[i] == NULL) { ans = 8; flag = false; break; } if ((int)(num[i] - '0') % 8 != 0)break; } if (flag) { for (int i = 0;; i++) { if (num[i] == NULL) { ans = 4; flag = false; break; } if ((int)(num[i] - '0') % 4 != 0)break; } } if (flag) { for (int i = 0;; i++) { if (num[i] == NULL) { ans = 2; flag = false; break; } if ((int)(num[i] - '0') % 2 != 0)break; } } for (int i = 0;; i++) { if (num[i] == NULL) { ans *= 5; flag = false; break; } if ((int)(num[i] - '0') % 5 != 0)break; } for (int i = 0;; i++) { if (num[i] == NULL) { ans *= 7; flag = false; break; } if ((int)(num[i] - '0') % 7 != 0)break; } for (int i = 0;; i++) { if (num[i] == NULL)break; sum += num[i] - '0'; } while (sum % 3 == 0) { sum /= 3; ans*=3; } cout <<ans<< "\n"; return 0; }