QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#374302 | #3716. Simple Arithmetic | ucup-team1251 | AC ✓ | 0ms | 3668kb | C++17 | 618b | 2024-04-02 13:32:49 | 2024-04-02 13:32:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#define endl '\n'
void solve() {
int a,b;
while(cin>>a>>b) {
if(a==-9223372036854775808){
if(b==-1)cout<<"9223372036854775808"<<endl;
else {
if(b<0)cout<<a/b<<endl;
else cout<<a/b-(a%b!=0)<<endl;
}
continue;
}
int now=1;
if(a<0)now*=-1,a=-a;
if(b<0)now*=-1,b=-b;
// cout<<a<<" "<<b<<endl;
if(now>0)cout<<a/b<<endl;
else cout<<-a/b-(a%b!=0)<<endl;
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// int _;
// cin>>_;
// while(_--)
solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
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