DS1 4 poj 1552 Doubles 测试组数和每组测试用例的个数不定

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               
#include <iostream>#include <cstdio>using namespace std;const int maxn  = 20;int main()int a[maxn]; cin >> a[0]; while(a[0] != - 1){  int i = 1,j,count = 0;  for(; ; i++){   scanf("%d",&a[i]);   if(a[i] == 0){    break;   }  }  int n = i;  for(i = 0 ; i < n - 1 ; ++i){   for(j = i + 1 ; j < n ;++j ){    if(a[i]*2 == a[j] || a[j]*2 == a[i]){     count++;    }   }  }  printf("%d\n",count);  cin >> a[0]; }  return 0; }
Doubles
           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/sfhinsc/article/details/84060778