結果

問題 No.2784 繰り上がりなし十進和
ユーザー vwxyzvwxyz
提出日時 2024-07-01 23:21:34
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,470 bytes
コンパイル時間 982 ms
コンパイル使用メモリ 95,360 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-01 23:21:43
合計ジャッジ時間 8,641 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <bitset>
#include <tuple>

int main() {
    std::vector<std::vector<int>> A(6, std::vector<int>(6));
    for (int i = 0; i < 6; ++i) {
        std::string input;
        std::cin >> input;
        for (int j = 0; j < 6; ++j) {
            A[i][j] = input[j] - '0';
        }
    }

    std::bitset<1000000> seen;
    seen.reset();
    std::vector<int> pow10={1,10,100,1000,10000,100000};
    for (int d1 = 0; d1 < 10; ++d1) {
        for (int d2 = 0; d2 < 10; ++d2) {
            for (int d3 = 0; d3 < 10; ++d3) {
                for (int d4 = 0; d4 < 10; ++d4) {
                    for (int d5 = 0; d5 < 10; ++d5) {
                        for (int d6 = 0; d6 < 10; ++d6) {
                            int idx = 0;
                            for (int i = 0; i < 6; ++i) {
                            	std::vector<int> d={d1,d2,d3,d4,d5,d6};
                                int sum = 0;
                                for (int j = 0; j < 6; ++j) {
                                    sum += A[i][j] * d[i];
                                }
                                idx += (sum % 10) * pow10[i];
                            }
                            seen.set(idx);
                        }
                    }
                }
            }
        }
    }
    int ans=0;
    for(int i=0;i<1000000;i++){
    	if(seen[i]){
    		ans+=1;
    	}
    }
    std::cout << ans << std::endl;
    
    return 0;
}
0