結果

問題 No.443 GCD of Permutation
ユーザー 🍮かんプリン
提出日時 2020-06-04 14:05:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,048 bytes
コンパイル時間 2,617 ms
コンパイル使用メモリ 159,756 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-28 23:10:53
合計ジャッジ時間 3,887 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 9
権限があれば一括ダウンロードができます

ソースコード

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