QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#374370 | #3716. Simple Arithmetic | wanyurukong | AC ✓ | 12ms | 3556kb | C++17 | 1.8kb | 2024-04-02 13:53:50 | 2024-04-02 13:53:51 |
Judging History
answer
#include<bits/stdc++.h>
#define lowbit(x) (x&(-x))
#define rep(x,a,b) for(int x=a;x<=b;x++)
#define pre(x,a,b) for(int x=a;x>=b;x--)
#define ac puts("Yes")
#define wa puts("No")
#define endl "\n"
#define pb push_back
#define ll long long
#define pii pair<ll,ll>
#define psi pair<string, ll>
#define de cout<<1;
#define mem(a,x) memset(a,x,sizeof a)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
// static char buf[100000],*pa=buf,*pd=buf;
// #define gc pa==pd&&(pd=(pa=buf)+fread(buf,1,100000,stdin),pa==pd)?EOF:*pa++
// inline int read()
// {
// register int x(0);register char c(gc);
// while(c<'0'||c>'9')c=gc;
// while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=gc;
// return x;
// }
const int mod1=998244353;
const int mod2=1e9+7;
const int N = 1e6 + 60;
int number;
void read(__int128 &x)
{
x = 0;int f = 1;char ch = getchar();
while(!isdigit(ch)) {if(ch == '-') f = -1;ch = getchar();}
while(isdigit(ch)){x = x * 10 + ch - 48;ch = getchar();}
x *= f;
}
inline void print(__int128 x)
{
if(x < 0)
{
putchar('-');
x = -x;
}
if(x > 9)print(x/10);
putchar(x%10+'0');
}
void solve()
{
string n, m;
__int128 x = 0, y = 0;
while(cin >> n)
{
cin >> m;
x = 0, y = 0;
int f = 0;
f %= 2;
rep(i, 0, n.size()-1)
{
if(n[i] == '-') continue;
x *= 10;//print(x);
x += (n[i] - '0');
}
rep(i, 0, m.size()-1)
{
if(m[i] == '-') continue;
y *= 10;
y += (m[i] - '0');
}
if(n[0] == '-') x = -x;
if(m[0] == '-') y = -y;
// print(x);
// cout << endl;print(y);cout<<endl;
if(x % y == 0)print(x/y);
else if(x == 0) cout << 0;
else if(x > 0 && y > 0) print(x/y);
else if(x < 0 && y < 0) print(x/y);
else print((x / y) - 1);
cout << endl;
}
}
int main()
{
//IOS;
int _;
//cin >> _;
_ = 1;
while(_ -- )
{
number++;
solve();;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 12ms
memory: 3556kb
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