对方不想和你说话,并向你扔了一串数…… 而你必须从这一串数字中找到“250”这个高大上的感人数字。
输入格式:
输入在一行中给出不知道多少个绝对值不超过1000的整数,其中保证至少存在一个“250”。
输出格式:
在一行中输出第一次出现的“250”是对方扔过来的第几个数字(计数从1开始)。题目保证输出的数字在整型范围内。
输入样例:
888 666 123 -233 250 13 250 -222
输出样例:
5
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#include <iomanip>
#include<map>
#include<set>
#include<queue>
#include<stack>
#define ll long long
using namespace std;
int main() {
int num;
int cnt = 1;
int flag = 0;
while (cin >> num)
{
if (num == 250)
flag = cnt;
if(!flag)
cnt++;
}
cout << flag << endl;
}