QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#189271#3716. Simple ArithmeticCidoai#TL 0ms0kbC++20683b2023-09-27 07:41:072023-09-27 07:41:08

Judging History

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

  • [2023-09-27 07:41:08]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2023-09-27 07:41:07]
  • 提交

answer

#include<cstdio>
typedef long long ll;
typedef __int128 Ln;
inline ll read(){
	ll x=0;
	int f=0,ch=0;
	while(ch<48||ch>57) f=(ch=='-'),ch=getchar();
	while(ch>47&&ch<58) x=(x<<3)+(x<<1)+(ch&15),ch=getchar();
	return f?-x:x;
}
inline void write(Ln x,char end='\n'){
	if(x==0){
		putchar('0');
		putchar(end);
		return;
	}
	if(x<0) putchar('-'),x=-x;
	int ch[70]={0},cnt=0;
	while(x){
		ch[cnt++]=(int)(x%10);
		x/=10;
	}
	while(cnt--) putchar(ch[cnt]+48);
	putchar(end);
}
int main(){
	ll x,y;
	while(~scanf("%lld%lld",&x,&y)){
		Ln a=x,b=y;
		Ln ans=a/b;
		if(ans>=0) while(b*ans>a) ans--;
		else while(b*ans<a) ans--;
		write(ans);
	}
	return 0;
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:

3 2
3 -2
-9223372036854775808 1
-9223372036854775808 -1
9223372036854775807 1
9223372036854775807 -1
-9223372036854775808 2
-9223372036854775808 -2
9223372036854775807 2
9223372036854775807 -2
-2076046199237518199 8895005889588087898
-3939164353449408 -1673591601308294572
236330652387008908 24746725...

output:


result: