QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#760425#3792. 搞笑版费马大定理cat123100 ✓3ms3580kbC++141.3kb2024-11-18 16:54:562024-11-18 16:54:58

Judging History

This is the latest submission verdict.

  • [2024-11-18 16:54:58]
  • Judged
  • Verdict: 100
  • Time: 3ms
  • Memory: 3580kb
  • [2024-11-18 16:54:56]
  • Submitted

answer

#include<bits/stdc++.h>
#define LL long long
#define SZ(x) ((LL)(x.size()))
#define all(x) (x).begin(),(x).end()
using namespace std;
inline LL read(){
  LL q=0,w=1;char ch=getchar();
  while(ch>'9' || ch<'0'){if(ch=='-')w=-1;ch=getchar();}
  while(ch>='0'&&ch<='9'){q=q*10+(ch-'0');ch=getchar();}
  return q*w;
}
#define ll long long
void write(ll x){
  if(x<0){putchar('-');x=(-x);}
  if(x>9)write(x/10);
  putchar('0'+x%10);
}
inline void writeln(ll x){write(x);puts("");}
inline void writecs(ll x){write(x);putchar(' ');}

#define pb push_back
#define cout cerr

inline void dmin(LL &x,LL y){if(x>y)x=y;return ;}
inline void dmax(LL &x,LL y){if(x<y)x=y;return ;}

inline LL qpow(LL a,LL b,LL p){LL ans=1;while(b){if(b&1)ans=(ans*a)%p;b>>=1;a=(a*a)%p;}return ans;}
const LL mod = 998244353;
inline void amod(LL &x,LL y){x+=y;if(x>=mod)x-=mod;}
inline void smod(LL &x,LL y){x-=y;if(x<0)x+=mod;}
inline LL dmod(LL x){if(x<0)x+=mod;if(x>=mod)x-=mod;return x;}
inline LL inv(LL x){return qpow(x,mod-2,mod);}

int main(){
  LL x=0,y=0,TC=0;
  while(cin>>x>>y){
    TC++;
    LL ans=0;
    for(LL a=x;a<=1000;a++)
      for(LL b=x;b<=1000;b++){
	LL c=a*a*a+b*b*b;
	if((c%10)==3){
	  c/=10;
	  if(x<=c&&c<=y)ans++;
	}
      }
#undef cout
    cout<<"Case"<<" "<<TC<<": ";
    writeln(ans);
  }
  return 0;
}

詳細信息


Pretests


Final Tests

Test #1:

score: 100
Accepted
time: 3ms
memory: 3580kb

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