結果

問題 No.2593 Reorder and Mod 120
ユーザー inkyamaninkyaman
提出日時 2024-03-24 12:23:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,264 bytes
コンパイル時間 1,323 ms
コンパイル使用メモリ 125,724 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-24 12:23:51
合計ジャッジ時間 2,399 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <iomanip>
#include <climits>
#include <functional>
#include <cassert>
#include <tuple>
using namespace std;
using ll = long long;

int N;
string S;

int main() {

    cin >> N >> S;
    vector<int> cnt(10);
    int sum = 0;
    for(int i = 0; i < N; ++i) {
        cnt[int(S[i]-'0')]++;
        sum += int(S[i]-'0');
    }

    set<int> st;
    for(int i = 1; i < 10; ++i) {
        for(int j = i; j < 10; ++j) {
            for(int k = j; k < 10; ++k) {
                if(i == j && j == k && cnt[i] < 3) continue;
                else if(i == j && cnt[i] < 2 || j == k && cnt[j] < 2) continue;
                else if(cnt[i] < 1 || cnt[j] < 1 || cnt[k] < 1) continue;
                vector<int> vec = {i,j,k};
                do {
                    int n = vec[0]*100+vec[1]*10+vec[2];
                    st.insert(n%40);
                } while(next_permutation(vec.begin(),vec.end()));
            }
        }
    }
    cout << st.size() << endl;
    // cout << "st:" << endl;
    // for(int v : st) cout << v << endl;
    

}
0