結果

問題 No.443 GCD of Permutation
ユーザー BantakoBantako
提出日時 2018-05-31 01:06:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 767 bytes
コンパイル時間 1,656 ms
コンパイル使用メモリ 165,456 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-12 20:54:34
合計ジャッジ時間 3,167 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,384 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;

main(){
    
    string S;
    cin >> S;
    ll sum = 0;
    int cnt[10] = {};
    for(auto c:S){
        sum += c - '0';
        cnt[c - '0']++;
    }
    int bit = 0;
    rep(i,9){
        bit += ((bool)cnt[i+1]) << i;
    }
    if(__builtin_popcount(bit) == 1){
        cout << S << endl;
        return 0;
    }
    int ans = 1;
    if(sum % 9 == 0)ans *= 9;
    else if(sum % 3 == 0)ans *= 3;

         if(bit == 0b000010000)  ans *= 5;
         if(!(bit & 0b101111111))ans *= 8;
    else if(!(bit & 0b101110111))ans *= 4;
    else if(!(bit & 0b101010101))ans *= 2;

    cout << ans << endl;
    
}
0