結果
| 問題 | No.3823 Make 1 |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-11-24 14:49:07 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 11 ms / 2,000 ms |
| + 615µs | |
| コード長 | 751 bytes |
| 記録 | |
| コンパイル時間 | 198 ms |
| コンパイル使用メモリ | 59,092 KB |
| 実行使用メモリ | 9,860 KB |
| 最終ジャッジ日時 | 2026-11-24 14:49:09 |
| 合計ジャッジ時間 | 2,098 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3823.cc: No.3823 Make 1 - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 100000;
/* typedef */
/* global variables */
char s[MAX_N + 4];
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
int n;
scanf("%d%s", &n, s);
if (n == 1) {
if (s[0] == '1') puts("Yes");
else puts("No");
continue;
}
int sum = 0;
for (int i = 0; i < n; i++) sum += (s[i] - '0') + 1;
if (sum % 3 == 2) {
bool ok = false;
for (int i = 0; ! ok && i + 1 < n; i++)
ok = (s[i] == s[i + 1]);
if (ok) {
puts("Yes");
continue;
}
}
puts("No");
}
return 0;
}
tnakao0123