QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#395690 | #8330. Count off 3 | xlwang | RE | 0ms | 0kb | C++14 | 2.0kb | 2024-04-21 17:17:13 | 2024-04-21 17:17:13 |
answer
#include<bits/stdc++.h>
#define fr(i,j,k) for(register int i=j;i<=k;++i)
#define rf(i,j,k) for(register int i=j;i>=k;--i)
#define foredge(i,j) for(register int i=head[j];i;i=e[i].nxt)
#define pb push_back
#define Times printf("Time:%.3lf\n",clock()/CLOCKS_PER_SEC)
using namespace std;
inline int read(){
int x=0;
bool f=0;
char c=getchar();
while(!isdigit(c)) f|=(c=='-'),c=getchar();
while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
return f?-x:x;
}
inline void write(int x){
if(x<0){putchar('-');x=-x;}
if(x>9)write(x/10);
putchar(x%10+'0');
}
inline void writeln(int x){write(x); puts("");}
inline void writepl(int x){write(x); putchar(' ');}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline int randfind(int l,int r){return rnd()%(r-l+1)+l;}
//inline void init(){
// int t=read();
// while(t--) work();
//}
const int Maxn=1e5+10,mod=1e9+7;
inline void add(int &x,int y){
x+=y;if(x>=mod) x-=mod;
}
int f1[7][7][7],f2[7][7][7];
int n;
char c[Maxn];
int ans;
inline void clear(){
memset(f1,0,sizeof(f1)),memset(f2,0,sizeof(f2));
ans=0;
}
int s1[Maxn][4],s2[Maxn][4];
inline int ksm(int x,int y,int mod){
int sum=1;
while(y){
if(y&1) sum=sum*x%mod;
y=y/2;x=x*x%mod;
}
return sum;
}
inline int check(int x,int y){
int now=0;
fr(i,1,n) now=(now+((1<<(n-i))&(x))*ksm(y,n-i,7))%7;
// cout<<now<<endl;
return now!=0;
}
inline void work(){
scanf("%s",c+1);n=strlen(c+1);
int tot=0;
fr(i,1,n) tot+=(1<<(n-i))*(c[i]=='1');
fr(i,1,tot){
int flag=1;
fr(j,1,7) flag&=check(i,j);
if(flag){
fr(j,1,n) cout<<((i&(1<<(n-j)))>0);
cout<<endl;
}
ans+=flag;
}
writeln(ans);
}
inline void init(){
int t=read();
while(t--) work();
}
signed main(){
freopen("input.in","r",stdin);
freopen("output1.out","w",stdout);
init();
// printf("\nTIME:%.3lf",(double)clock()/CLOCKS_PER_SEC);
return 0;
}
详细
Test #1:
score: 0
Dangerous Syscalls
input:
5 1 1010 110101 1000111000 101101001000