結果

問題 No.443 GCD of Permutation
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2020-06-04 14:05:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,048 bytes
コンパイル時間 2,588 ms
コンパイル使用メモリ 144,704 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-19 08:19:19
合計ジャッジ時間 5,316 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
4,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 1 ms
4,380 KB
testcase_29 WA -
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.06.04 14:04:59
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    string s;cin >> s;
    bool zoro = true;
    bool two = true;
    bool three = true;
    bool four = true;
    bool five = true;
    bool nine = true;
    int sum = 0;
    for (int i = 0; i < s.size(); i++) {
        if (i >= 1 && s[i] != s[i-1]) {
            zoro = false;
        }
        if ((s[i] - '0') % 2 != 0) {
            two = false;
        }
        if ((s[i] - '0') % 4 != 0) {
            four = false;
        }
        if ((s[i] - '0') % 5 != 0) {
            five = false;
        }
        sum += s[i]-'0';
    }
    if (zoro) {
        cout << s << endl;
        return 0;
    }
    if (sum % 3 != 0) {
        three = false;
    }
    if (sum % 9 != 0) {
        nine = false;
    }
    ll ans = 1;
    if (two) ans*=2;
    if (three) ans*=3;
    if (four) ans*=2;
    if (five) ans*=5;
    if (nine) ans *= 3;
    cout << ans << endl;
    return 0;
}
0