社区讨论

atcoder2024/4/13的第二题样例过了测试点不对

题目总版参与者 4已保存回复 3

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
3 条
当前快照
1 份
快照标识符
@luy455z3
此快照首次捕获于
2024/04/13 21:08
2 年前
此快照最后确认于
2024/04/13 21:33
2 年前
查看原帖

求改

CPP
#include<bits/stdc++.h> 
using namespace std;

int main() {
    string S;
    cin >> S;
    int count[26][101] = {0};

    // 更新count数组
    for (int i = 0; i < S.size(); i++) {
        char c = S[i];
        count[c - 'a'][++count[c - 'a'][0]]++;
    }

    int flag = 0;
    for (int i = 1; i <= S.size(); i++) {
        int unique_chars = 0;
        for (int j = 0; j < 26; j++) {
            if (count[j][i] > 0) {
                unique_chars++;
            }
        }
        if (unique_chars == 1) {
            flag = 1;
            break;
        }
    }

    if (flag == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}
CPP
/**
 *                             _ooOoo_
 *                            o8888888o
 *                            88" . "88
 *                            (| -_- |)
 *                            O\  =  /O
 *                         ____/`---'\____
 *                       .'  \\|     |//  `.
 *                      /  \\|||  :  |||//  \
 *                     /  _||||| -:- |||||-  \
 *                     |   | \\\  -  /// |   |
 *                     | \_|  ''\---/''  |   |
 *                     \  .-\__  `-`  ___/-. /
 *                   ___`. .'  /--.--\  `. . __
 *                ."" '<  `.___\_<|>_/___.'  >'"".
 *               | | :  `- \`.;`\ _ /`;.`/ - ` : | |
 *               \  \ `-.   \_ __\ /__ _/   .-` /  /
 *          ======`-.____`-.___\_____/___.-`____.-'======
 *                             `=---='
 *          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 		帮个忙吧				QaQ
 * 				| | |
 *                              | | |
 *                              | | |
 *                           ===========
 *                          /           \
 *                         |             \
 *                         \_____________/
 
**/

回复

3 条回复,欢迎继续交流。

正在加载回复...