- 一道简单的字符串判断问题。
思路
输入 ,然后循环 次,每次输入一个字符串,如果不是 ,就说明没有通过,将编号记录在一个数组中,最后直接输出即可。
AC Code
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define IO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int E=1e6+5;
ll n,cnt;
ll arr[E];
int main(){
IO;
cin >>n;
for(int i=0;i<n;i++){
string x;
cin >>x;
if(x!="AC")arr[cnt++]=i+1;
}
for(int i=0;i<cnt;i++)cout <<arr[i]<<" ";
return 0;
}