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:老实翻译的怎么会WA?help

Posted by 810974380 at 2009-07-27 20:22:09 on Problem 1552
In Reply To:老实翻译的怎么会WA?help Posted by:OSJake at 2009-06-17 13:17:58
>
输入这样不好!!!把我的给你看以下!AC了的!

#include<iostream>
using namespace std;
int main()
{ int num,a[20];
 while(cin>>(a[0]))
  {if(a[0]==-1) break;
   num=0;int i;
  for(i=1;;i++)
   {cin>>a[i];
   if(a[i]==0) break;
  }
   for(int j=0;j<i;j++)
	 for(int k=j+1;k<i;k++)
	  if(a[j]==2*a[k]||a[j]*2==a[k]) num++;
	cout<<num<<endl;
  }
  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