对方不想和你说话,并向你扔了一串数…… 而你必须从这一串数字中找到“250”这个高大上的感人数字。
输入格式:
输入在一行中给出不知道多少个绝对值不超过1000的整数,其中保证至少存在一个“250”。
输出格式:
在一行中输出第一次出现的“250”是对方扔过来的第几个数字(计数从1开始)。题目保证输出的数字在整型范围内。
输入样例:
888 666 123 -233 250 13 250 -222
输出样例:
5
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int a=0,count=0,flag=0;
while(scanf("%d",&a)!=EOF) //ctrl+Z终止输入
{
count++;
if(a==250&&flag==0)
{
printf("%d",count);
flag=1;
}
}
return 0;
}