Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:郁闷啊!为什么scanf就对而cin就错?附程序

Posted by 20072503 at 2009-07-21 10:02:45 on Problem 2664
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator