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 |
是不是我忽略了什么特殊情况啊?希望指教#include <iostream.h> int main() { int n,m,sum; int num[1000]; sum = 1; cin >> n >> m; for(int i = 0;i < n*m;i++){ cin>>num[i]; for(int j = 0;j < i;j++){ if(num[i] == num[j])break; if(j == i-1){ sum++; } } } for(int k = 0;k < n*m;k++){ if(num[k] == 0)sum--;break; } cout<<sum<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator