結果

問題 No.2784 繰り上がりなし十進和
ユーザー 沙耶花
提出日時 2024-06-14 21:57:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 748 bytes
コンパイル時間 4,502 ms
コンパイル使用メモリ 252,696 KB
最終ジャッジ日時 2025-02-21 21:58:32
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001
int get(int a,int b){
	int ret = 0;
	int cur = 1;
	rep(i,6){
		int x = (a%10) + (b%10);
		a/=10,b/=10;
		ret += (x%10)*cur;
		cur *= 10;
	}
	return ret;
	
}

int main(){
	
	vector<bool> dp(1000000,false);
	dp[0] = true;
	rep(i,6){
		int n;
		cin>>n;
		int c = 0;
		rep(j,4){
			c = get(c,n);
			vector<bool> ndp = dp;
			rep(k,1000000){
				if(dp[k]){
					ndp[get(k,c)] = true;
				}
			}
			swap(dp,ndp);
		}
		
	}
	int ans = 0;
	rep(i,1000000){
		if(dp[i]) ans++;
	}cout<<ans<<endl;
	return 0;
}
0