QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#374375#3716. Simple ArithmeticwanyuWA 11ms3600kbC++17764b2024-04-02 13:55:552024-04-02 13:55:55

Judging History

This is the latest submission verdict.

  • [2024-04-02 13:55:55]
  • Judged
  • Verdict: WA
  • Time: 11ms
  • Memory: 3600kb
  • [2024-04-02 13:55:55]
  • Submitted

answer

#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<math.h>
#include<set>
#define int long long int
#define INF 0x3f3f3f3f
#define unint unsigned long long
using namespace std;
int a,b,c;
vector<int> V;
string x,y;
signed main()
{
	while(cin>>a>>b)
	{
		V.clear();
		if(a<-9223372036854775807&&b<0)
		{
			a=-a;
			b=-b;
			c=a/b;
			while(c)
			{
				int tmp=c%10;
				V.push_back(-tmp);
				c/=10;
			}
			for(int i=V.size()-1;i>=0;i--)cout<<V[i];
			continue;
		}
		int x=0;
		if(a<0)
		a=-a,x++;
		if(b<0)
		b=-b,x++;
		int s=a/b;
		if(x==1)
		{
			if(a%b==0)
			cout<<-s<<endl;
			else
			cout<<-(s+1)<<endl;
		}
		else
		{	
			cout<<s<<endl;
		}

	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 11ms
memory: 3600kb

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:

1
-2
-9223372036854775808
92233720368547758089223372036854775807
-9223372036854775807
4611686018427387904
46116860184273879044611686018427387903
-4611686018427387904
-1
0
0
-1
-1
2
-2
-1
0
-2
1
0
0
-2
1
0
-37
0
0
3
-1
8
-1
8
-1
-1
-2
0
0
2
8
-1
0
-1
-2
-1
-5
-7
-1
-2
-3
-1
1
0
-11
-1
2
-1
11
8
0
0
-...

result:

wrong answer 4th words differ - expected: '9223372036854775808', found: '92233720368547758089223372036854775807'