7-1 统计比指定元素大的个数-hebust

7-1 统计比指定元素大的个数-hebust

统计比指定元素大的个数

输入格式:

输入为2行,第一行为参照的整数元素,第二行为参与统计的整数元素,之间使用空格分割。

输出格式:

输出为比指定的参照元素大的元素个数。

输入样例:

在这里给出一组输入。例如:

5
2 3 6 7 3 4 9 8

输出样例:

在这里给出相应的输出。例如:

4

#include <iostream>
using namespace std;
int main(){
  int a,b;
  int count =0;
  scanf("%d",&a);
  while(1){
    scanf("%d",&b);
    if(b>a){
      count++;
    }
    if(cin.get()=='\n'){
      break;
    }
  }
  printf("%d",count);
  return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_37871668/article/details/88946999
7-1