QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#755335#9555. Strengthucup-team3564#Compile Error//Python32.4kb2024-11-16 17:06:102024-11-16 17:06:10

Judging History

你现在查看的是最新测评结果

  • [2024-11-16 17:06:10]
  • 评测
  • [2024-11-16 17:06:10]
  • 提交

answer

// MagicDark
#include <bits/stdc++.h>
#define debug cerr << "\33[32m[" << __LINE__ << "]\33[m "
#define SZ(x) ((int) x.size() - 1)
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> T& chkmax(T &x, T y) {return x = max(x, y);}
template <typename T> T& chkmin(T &x, T y) {return x = min(x, y);}
template <typename T> T& read(T &x) {
	x = 0; int f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = - f;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	return x *= f;
}
const int T = 18;
ll dp[25][3][2], pw10[25];
void zhk() {
	ll x, z; cin >> x >> z;
	ms(dp, 0);
	dp[0][0][1] = 1;
	F(i, 0, 18) {
		int u = z / pw10[i] % 10;
		int w = x / pw10[i] % 10;
		F(a, 0, 9) F(o, 0, 2) F(t, 0, 1) {
			int p = 0;
			if (o != 1) {
				if (a == w) p |= 1;
				else if (!w) {
					if (a <= 4) p |= 1;
					else p |= 2;
				}
			}
			if (o != 0) {
				if (a + 1 == w) p |= 1;
				else {
					if (!w) {
						if (a == 4) p |= 3;
						else if (a < 4) p |= 1;
							else p |= 2;
					} else if (w == 1) {
						if (a <= 4) p |= 1;
						else p |= 2;
					}
				}
			}
			if (p) dp[i + 1][p - 1][(a == u ? t : (a < u))] += dp[i][o][t];
			// if (a == w) {
			// 	dp[i + 1][0][(a == u ? t : (a < u))] += dp[i][0][t];
			// }
			// if (a + 1 == w) {
			// 	dp[i + 1][0][(a == u ? t : (a < u))] += dp[i][1][t];
			// }
			// if (a < 5 && w == 0) {
			// 	dp[i + 1][0][(a == u ? t : (a < u))] += dp[i][0][t];
			// }
			// if (a >= 5 && w == 0) {
			// 	dp[i + 1][1][(a == u ? t : (a < u))] += dp[i][0][t];
			// }
			// if (a >= 4 && w == 0) {
			// 	dp[i + 1][1][(a == u ? t : (a < u))] += dp[i][1][t];
			// }
			// if (a >= 5 && w == 1) {
			// 	dp[i + 1][1][(a == u ? t : (a < u))] += dp[i][1][t];
			// }
		}
		// debug << dp[i][0][0] << " " << dp[i][0][1] << " " << dp[i][1][0] << " " << dp[i][1][1] << endl;
	}
	cout << dp[19][0][1] + dp[19][1][1] + dp[19][2][1] << '\n';
}
signed main() {
	ios::sync_with_stdio(0); // don't use puts
	cin.tie(0), cout.tie(0);
	pw10[0] = 1;
	F(i, 1, T) pw10[i] = 10 * pw10[i - 1];
	int _ = 1;
	cin >> _;
	while (_--) zhk();
	return 0;
}
/* why?
*/

Details

  File "answer.code", line 76
    	ios::sync_with_stdio(0); // don't use puts
    	                               ^
SyntaxError: unterminated string literal (detected at line 76)