QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#125657#3792. 搞笑版费马大定理ProtectEMmm100 ✓5ms3404kbC++231.3kb2023-07-17 09:06:252023-07-17 09:06:28

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-17 09:06:28]
  • Judged
  • Verdict: 100
  • Time: 5ms
  • Memory: 3404kb
  • [2023-07-17 09:06:25]
  • Submitted

answer

#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<unordered_map>
using namespace std;
/*====================*/
#define DEBUGX
#define endl "\n"
/*====================*/
typedef long long lnt;
/*====================*/
const int N = 1e6 + 10;
const int M = 1e6 + 10;
/*====================*/
const lnt MOD = 998244353;
const lnt INF = 0X3F3F3F3F;
/*====================*/
const int dx[] = { -1,1,0,0,-1,-1,+1,+1 };
const int dy[] = { 0,0,-1,1,-1,+1,-1,+1 };
/*====================*/

/*====================*/
void Solve(void)
{
	lnt l, r;
	int test = 0;
	while (cin >> l >> r)
	{
		int ans = 0;
		for (lnt a = l; a <= min(r, 1000ll); ++a)
		{
			for (lnt b = l; b <= min(r, 1000ll); ++b)
			{
				if ((a * a * a + b * b * b) % 10 == 3)
				{
					lnt c = (a * a * a + b * b * b) / 10;
					if (l <= c && c <= r)
					{
						ans++;
					}
				}
			}
		}
		cout << "Case " << ++test << ": " << ans << endl;
	}
}
/*====================*/
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\ProtectEMmm\\Desktop\\IN.txt", "r+", stdin);
#endif
	int T = 1; //cin >> T;
	while (T--)Solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 5ms
memory: 3404kb

input:

2 13
123 456789
111 9999999
1 100000000
500 100000000
700 100000000
750 100000000
780 98765432
788 98421754
788 98421753

output:

Case 1: 2
Case 2: 16
Case 3: 9998
Case 4: 88224
Case 5: 14440
Case 6: 1650
Case 7: 370
Case 8: 26
Case 9: 2
Case 10: 0

result:

ok 10 lines