跳到正文

题解

Judg. tj

_colin1112_约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
题目
P9686

版本

  1. v1当前
  • 一道简单的字符串判断问题。

思路

输入 nn,然后循环 nn 次,每次输入一个字符串,如果不是 AC\texttt {AC},就说明没有通过,将编号记录在一个数组中,最后直接输出即可。

AC Code

C++
#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;
}
原文