結果

問題 No.2784 繰り上がりなし十進和
ユーザー 👑 binapbinap
提出日時 2024-06-14 21:47:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,863 ms / 2,000 ms
コード長 3,053 bytes
コンパイル時間 5,010 ms
コンパイル使用メモリ 272,088 KB
実行使用メモリ 97,408 KB
最終ジャッジ日時 2024-06-14 21:47:51
合計ジャッジ時間 46,977 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 684 ms
6,816 KB
testcase_01 AC 734 ms
6,816 KB
testcase_02 AC 1,185 ms
97,408 KB
testcase_03 AC 658 ms
6,940 KB
testcase_04 AC 698 ms
6,940 KB
testcase_05 AC 680 ms
6,944 KB
testcase_06 AC 702 ms
6,940 KB
testcase_07 AC 687 ms
6,940 KB
testcase_08 AC 744 ms
6,944 KB
testcase_09 AC 728 ms
6,944 KB
testcase_10 AC 705 ms
6,944 KB
testcase_11 AC 755 ms
6,940 KB
testcase_12 AC 1,016 ms
97,408 KB
testcase_13 AC 1,041 ms
97,280 KB
testcase_14 AC 827 ms
26,880 KB
testcase_15 AC 769 ms
8,192 KB
testcase_16 AC 1,096 ms
12,928 KB
testcase_17 AC 1,552 ms
50,304 KB
testcase_18 AC 1,396 ms
50,432 KB
testcase_19 AC 1,088 ms
15,232 KB
testcase_20 AC 1,755 ms
97,408 KB
testcase_21 AC 1,109 ms
12,800 KB
testcase_22 AC 1,634 ms
97,408 KB
testcase_23 AC 985 ms
7,296 KB
testcase_24 AC 1,199 ms
22,272 KB
testcase_25 AC 1,603 ms
50,432 KB
testcase_26 AC 1,544 ms
97,408 KB
testcase_27 AC 1,810 ms
97,408 KB
testcase_28 AC 1,246 ms
27,008 KB
testcase_29 AC 1,863 ms
97,408 KB
testcase_30 AC 1,229 ms
27,008 KB
testcase_31 AC 1,000 ms
12,928 KB
testcase_32 AC 1,455 ms
50,432 KB
testcase_33 AC 1,430 ms
50,432 KB
testcase_34 AC 1,287 ms
22,272 KB
testcase_35 AC 981 ms
8,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef long double ld;
typedef pair<int, int> P;

ostream& operator<<(ostream& os, const modint& a) {os << a.val(); return os;}
template <int m> ostream& operator<<(ostream& os, const static_modint<m>& a) {os << a.val(); return os;}
template <int m> ostream& operator<<(ostream& os, const dynamic_modint<m>& a) {os << a.val(); return os;}
template<typename T> istream& operator>>(istream& is, vector<T>& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;}
template<typename U, typename T> ostream& operator<<(ostream& os, const pair<U, T>& p){os << p.first << ' ' << p.second; return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;}
template<typename T> ostream& operator<<(ostream& os, const set<T>& se){for(T x : se) os << x << " "; os << "\n"; return os;}
template<typename T> ostream& operator<<(ostream& os, const unordered_set<T>& se){for(T x : se) os << x << " "; os << "\n"; return os;}
template<typename S, auto op, auto e> ostream& operator<<(ostream& os, const atcoder::segtree<S, op, e>& seg){int n = seg.max_right(0, [](S){return true;}); rep(i, n) os << seg.get(i) << (i == n - 1 ? "\n" : " "); return os;}
template<typename S, auto op, auto e, typename F, auto mapping, auto composition, auto id> ostream& operator<<(ostream& os, const atcoder::lazy_segtree<S, op, e, F, mapping, composition, id>& seg){int n = seg.max_right(0, [](S){return true;}); rep(i, n) os << seg.get(i) << (i == n - 1 ? "\n" : " "); return os;}

template<typename T> void chmin(T& a, T b){a = min(a, b);}
template<typename T> void chmax(T& a, T b){a = max(a, b);}

struct Number{
	vector<int> a;
	Number(string s = "000000"){
		a.resize(6);
		rep(i, 6) a[i] = s[i] - '0';
	}
	Number operator*(int c) const {
		Number res;
		rep(i, 6) res.a[i] = (a[i] * c) % 10;
		return res;
	}
	Number operator+(Number right) const {
		Number res;
		rep(i, 6) res.a[i] = (a[i] + right.a[i]) % 10;
		return res;
	}
};

int main(){
	vector<Number> s;
	rep(i, 6){
		string t;
		cin >> t;
		Number number(t);
		s.push_back(t);
	}
	set<vector<int>> se;
	vector<int> var(6);
	for(var[0] = 0; var[0] < 10; var[0]++){
		for(var[1] = 0; var[1] < 10; var[1]++){
			for(var[2] = 0; var[2] < 10; var[2]++){
				for(var[3] = 0; var[3] < 10; var[3]++){
					for(var[4] = 0; var[4] < 10; var[4]++){
						for(var[5] = 0; var[5] < 10; var[5]++){
							Number res;
							rep(i, 6){
								res = res + s[i] * var[i];
							}
							se.insert(res.a);
						}
					}
				}
			}
		}
	}
	cout << se.size() << "\n";
	return 0;
}
0