QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#605131 | #8932. Bingo | PandaGhost | Compile Error | / | / | C++14 | 2.6kb | 2024-10-02 15:41:50 | 2024-10-02 15:41:51 |
Judging History
answer
#include<bits[表情]dc++.h>
using namespace std;
#define LL long long
#define fo(i,a,b) for(long long i=(a);i<=(b);i++)
#define fe(i,a,b) for(long long i=(a);i>=(b);i--)
const int N=1000010;
LL m,mod;
string a;
struct gjd
{
LL len;
LL num[N];
void Clear()
{
fo(i,0,len-1) num[i]=0;
len=0;
}
void add(LL x)
{
fo(i,0,len-1)
{
num[i]=num[i]+x%10;
x/=10;
if(num[i]>=10)
{
num[i]-=10;
x++;
}
}
if(x)
{
len++;
num[len-1]=x;
}
}
void replace(LL x)
{
LL u=0,cnt=x;
bool bb=0;
while(cnt)
{
u++;
cnt/=10;
}
fo(i,u-1,len-1)
{
LL p=0;
fo(j,0,u-1)
{
p=p*10+num[i-j];
}
if(p==x&&bb)
{
add(1);
return;
}
if(num[i-u+1]!=9) bb=1;
}
fo(i,u-1,len-1)
{
LL p=0;
fo(j,0,u-1)
{
p=p*10+num[i-j];
}
if(p<x)
{
LL o=x;
fo(j,i-u+1,i)
{
num[j]=o%10;
o/=10;
}
fo(j,0,i-u) num[j]=0;
return;
}
}
LL o=x;
len++;
fo(j,len-u,len-1)
{
num[j]=o%10;
o/=10;
}
fo(j,0,len-u-1) num[j]=0;
}
void bui(string s)
{
len=s.size();
fo(i,0,s.size()-1)
{
num[len-i-1]=s[i]-'0';
}
}
void output()
{
fe(i,len-1,0) cout<<num[i];
cout<<endl;
}
} A,B;
bool bj()
{
if(A.len<B.len) return 1;
if(A.len>B.len) return 0;
fe(i,A.len-1,0)
{
if(A.num[i]<B.num[i]) return 1;
if(A.num[i]>B.num[i]) return 0;
}
return 1;
}
void read(){
A.Clear();
B.Clear();
cin>>a>>m;
mod=0;
fo(i,0,a.size()-1)
{
mod=mod*10+a[i]-'0';
mod%=m;
}
A.bui(a);
B.bui(a);
A.add(m-mod);
B.replace(m);
if(bj())
{
A.output();
}
else{
B.output();
}
}
void solve()
{
read();
}
int main()
{
int tcase;
cin>>tcase;
while(tcase--) solve();
}
Details
answer.code:1:9: fatal error: bits[表情]dc++.h: No such file or directory 1 | #include<bits[表情]dc++.h> | ^~~~~~~~~~~~~~~~~~ compilation terminated.