Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:郁闷啊!为什么scanf就对而cin就错?附程序In Reply To:Re:郁闷啊!为什么scanf就对而cin就错?附程序 Posted by:wanpi0user at 2005-11-07 14:17:34 > //AC > #include <iostream> > using namespace std; > int main() > { > int k,m; > int i,j,t,s,c,min; > char f[10000],ok; > > while(cin>>k) > { > if(k==0) return 0; > for(i=0;i<10000;i++) > f[i]=0; > //scanf("%d",&m); > cin>>m; > for(i=0;i<k;++i) > { > //scanf("%d",&t); > cin>>t; > f[t]=1; > } > ok=1; > for(j=0;j<m;++j) > { > //scanf("%d%d",&c,&min); > cin>>c>>min; > for(s=0,i=0;i<c;++i) > { > //scanf("%d",&t); > cin>>t; > s+=f[t]; > } > if(s<min) > ok=0; > } > if(ok) cout<<"yes\n"; > else cout<<"no\n"; > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator