Submission #47465537


Source Code Expand

#include <bits/stdc++.h>
#define const constexpr
#define pb(x) push_back(x)
#define Y "Yes"
#define F "No"
#define mem(a, val) memset(a, val, sizeof(a))
#define rep(i, s, t) for (int i = (s); i <= (t); i++)
#define repp(i, t, s) for (int i = (t); i >= (s); i--)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f, MOD = 1e9 + 7;
const int N = 110;

template<typename T> inline void read(T &x) {
	x = 0; int f = 1; char c = getchar();
	while (!isdigit(c)) { if (c == '-') f = -1; c = getchar(); }
	while (isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); }
	x *= f;
}

ll qpow(int x, int y) {
	ll ret = 1;
	while (y > 0) {
		if (y & 1) ret = (ret * x) % MOD;
		x = (x * x) % MOD;
		y >>= 1;
	}
	return ret;
}

int n, t, a[N], x;


inline int check(int x) {
	int t = -2;
	while (x) {
		if (t != -2 && x % 10 != t) return -1;
		t = x % 10;
		x /= 10;
	}
	return t;
}

inline void solve() {
	int ans = 0;
	read(n);
	rep(i, 1, n) {
		read(a[i]);
	}
	rep(i, 1, n) {
		rep(j, 1, a[i]) {
			if (check(i) != -1 && check(j) != -1 && check(i) == check(j)) {
				ans++;
			}
		}
	}
	cout << ans;
	
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	t = 1;
//	read(t);
	while (t--) solve();
	return 0;
}

Submission Info

Submission Time
Task B - 11/11
User yhx0322
Language C++ 20 (gcc 12.2)
Score 200
Code Size 1337 Byte
Status AC
Exec Time 1 ms
Memory 3668 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 15
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_handmade_11.txt, 02_handmade_12.txt, 02_handmade_13.txt, 02_handmade_14.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3668 KiB
00_sample_01.txt AC 1 ms 3456 KiB
00_sample_02.txt AC 1 ms 3448 KiB
01_random_03.txt AC 1 ms 3512 KiB
01_random_04.txt AC 1 ms 3460 KiB
01_random_05.txt AC 1 ms 3456 KiB
01_random_06.txt AC 1 ms 3532 KiB
01_random_07.txt AC 1 ms 3532 KiB
01_random_08.txt AC 1 ms 3456 KiB
01_random_09.txt AC 1 ms 3576 KiB
01_random_10.txt AC 1 ms 3460 KiB
02_handmade_11.txt AC 1 ms 3452 KiB
02_handmade_12.txt AC 1 ms 3512 KiB
02_handmade_13.txt AC 1 ms 3664 KiB
02_handmade_14.txt AC 1 ms 3576 KiB