QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#536856#3716. Simple ArithmeticsudokuAC ✓3ms3908kbC++17747b2024-08-29 17:34:422024-08-29 17:34:42

Judging History

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

  • [2024-08-29 17:34:42]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3908kb
  • [2024-08-29 17:34:42]
  • 提交

answer

#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <queue>
#include <bitset>
#include<numeric>
#include <unordered_map>
#include <iomanip>
#include <map>
#include <stack>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    long long a,b;
    while(~scanf("%lld%lld", &a,&b))
    {
        unsigned long long x = abs(a);
        unsigned long long y = abs(b);
        unsigned long long z = x / y;
        if((a>=0&&b>=0)||(a<0&&b<0))
            printf("%llu\n", z);
        else
        {
            if(x%y==0)
                printf("-%llu\n", z);
            else
                printf("-%llu\n", z+1);
        }
    }
    return 0;
}

详细

Test #1:

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

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
9223372036854775808
9223372036854775807
-9223372036854775807
-4611686018427387904
4611686018427387904
4611686018427387903
-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
...

result:

ok 9875 tokens