标签:大学 computer clu where science sizeof ica exce tom
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N=437893890380859375; int main() { ll n; while(~scanf("%lld",&n)) { if(n>=N) printf("15\n"); else { for(int k=1; k<16; k++) { ll s=1; for(int i=0; i<k; i++) s*=k; if(s>n) { printf("%d\n",k-1); break; } } } } return 0; }
#include <stdio.h> #include <string.h> const int MD=1e9+7; typedef long long LL; struct matrix { LL mat[5][5]; }; matrix matmul(matrix a,matrix b,int n) { int i,j,k; matrix c; memset(c.mat,0,sizeof(c.mat)); for(i=0; i<n; i++) { for(j=0; j<n; j++) { for(k=0; k<n; k++) { c.mat[i][j]=(c.mat[i][j]+a.mat[i][k]*b.mat[k][j])%MD; } } } return c; } matrix matpow(matrix a,LL k,int n) { matrix b; int i; memset(b.mat,0,sizeof(b.mat)); for(i=0; i<n; i++) b.mat[i][i]=1; while(k) { if(k&1) b=matmul(a,b,n); a=matmul(a,a,n); k>>=1; } return b; } int main() { LL k; matrix a,b; memset(a.mat,0,sizeof(a.mat)); memset(b.mat,0,sizeof(b.mat)); a.mat[0][0]=1,a.mat[2][0]=1,a.mat[3][0]=1; b.mat[0][0]=1,b.mat[0][1]=5,b.mat[0][2]=1,b.mat[0][3]=-1; b.mat[1][0]=1,b.mat[2][1]=1,b.mat[3][2]=1; while(~scanf("%lld",&k)) { printf("%lld\n",(matmul(matpow(b,k,4),a,4).mat[0][0]+MD)%MD); } return 0; }
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e5+10; int a[N],b[N]; int main() { int n,m; while(~scanf("%d%d",&n,&m)) { memset(b,0,sizeof(b)); int Xor=0,And=0xffffffff,Or=0; for(int i=1; i<=n; i++) { int x; scanf("%d",&x); a[i]=x; And&=x; Or|=x; Xor^=x; for(int j=0; x; j++,x>>=1) b[j]+=x%2; } while(m--) { int q; scanf("%d",&q); q=a[q]; int A=And,O=Or,X=Xor; X=X^q; for(int j=0; j<=30; j++,q>>=1) { if(b[j]==n-1&&q%2==0)A+=(1<<j); if(b[j]==1&&q%2)O-=(1<<j); } printf("%d %d %d\n",A,O,X); } } return 0
标签:大学 computer clu where science sizeof ica exce tom
原文地址:http://www.cnblogs.com/BobHuang/p/7460863.html