首页 > 其他分享 >Codeforces Round 928 (Div. 4) (小白的复盘)

Codeforces Round 928 (Div. 4) (小白的复盘)

时间:2024-02-20 14:35:14浏览次数:18  
标签:cnt int namespace cin Codeforces 928 include Round

A. Vlad and the Best of Five

思路:

给你一个长度字符串只包含A和B输出最多的字符

解法:

按题意来

Code:

#include<bits/stdc++.h>

using namespace std;

int main() {
    int t; cin >> t;
    while (t --) {
        string s; cin >> s;
        int cnt = 0;
        for (char x : s) {
            if (x == 'A') {
                cnt++;
            }
        }
        if (cnt > 2) {
            cout << 'A' << '\n';
        }
        else {
            cout << 'B' << '\n';
        }
    }
    return 0;
}

  

Code:

#include<bits/stdc++.h>

using namespace std;

void solve() {
    int n; cin >> n;
    vector<string> s(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> s[i];
        s[i] = '#' + s[i];
    }
    int miy = 15, may = -1, cnt = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (s[i][j] == '1') {
                miy = min(miy, j);
                may = max(may, j);
                cnt++;
            }
        }
    }
    cout << ((may - miy + 1) * (may - miy + 1) == cnt ? "SQUARE\n" : "TRIANGLE\n"); 
}

int main() {
    int t; cin >> t;
    while (t--) {  solve();  }
    return 0;
}

/* TRIANGLE
SQUARE */

  

标签:cnt,int,namespace,cin,Codeforces,928,include,Round
From: https://www.cnblogs.com/youhualiuh/p/18023006

相关文章

  • Codeforces Round 928 (Div. 4)(A、B、C、D、E、G)
    目录ABCDEGA统计A、B输出#include<bits/stdc++.h>#defineintlonglong#definerep(i,a,b)for(inti=(a);i<=(b);++i)#definefep(i,a,b)for(inti=(a);i>=(b);--i)#definepiipair<int,int>#definelllonglong#definedbdouble#de......
  • Codeforces Round 928 (Div. 4)
    总结一下最近:感觉过于追求进度了,没有好好的把每题都吃透消化,然后有点依赖题解了,没有好好的思考...B.VladandShapesB题输入二维数组的时候不可以直接两个for循环然后cin,要读入char,再转为数字赋值给二维数组,因为他读入的时候不带有空格而int是要有空格的,这样子比如读000就把它......
  • 2023.2.19 LGJ Round
    A每道题有做出的时长\(t\),价值为\(k\),你需要求最大的\(c(c\in[0,1])\):若\(T=\sumt\),设一道题做出的时间为\(x\),那么分数为\(f(i,x,c)=k_i(1-\dfrac{cx}{T})\),在分数和最大的情况下,任意一种办法,使得每道题最终得分大小关系和价值大小关系一样。\(n\le2e5\).明显的二......
  • CF-928(已更新:B C E)
    CF-928排名四千多,目前为止排名最高的一场~E题我赛时基本上是猜的结论(但是也推了快一小时才想到有这个可能性),因此目前只能放个码在这(⊙﹏⊙)D的话问了学长思路,正在补了0-^-0……但是上一场牛客打得特别烂(⊙﹏⊙),还是等我补了牛客的再更新吧-^-B分析观察它的性质,答案为正方......
  • Codeforces Round 924 (Div. 2)
    目录写在前面ABCDEF写在最后写在前面比赛地址:https://codeforces.com/contest/1928。终于把欠下的一堆题补上了呃呃天使骚骚共通线什么构式呃呃,一周目就想走老师线直通单身笑死我了。A签到。发现等分后重新拼接可以得到\(\frac{x}{2}\times2y\)与\(\frac{y}{2}\times2......
  • Codeforces Round 927 (Div. 3)(A~F)
    目录ABCDEFA第一个遇到连续两个荆棘的地方就不能再赢金币了。所以统计连续两个荆棘之前的所有金币#include<bits/stdc++.h>#defineintlonglong#definerep(i,a,b)for(inti=(a);i<=(b);++i)#definefep(i,a,b)for(inti=(a);i>=(b);--i)#definepiipai......
  • Codeforces Round 927 (Div. 3)
    CodeforcesRound927(Div.3)A-ThornsandCoins解题思路:出现连续两个障碍之前,所有金币都能拿到。代码:#include<bits/stdc++.h>usingnamespacestd;usingll=longlong;usingpii=pair<ll,ll>;#definefifirst#definesesecondusingi128=__int128_t;......
  • 2024 SICTF Round#3出题 crypto misc osint
    有幸参与了本次比赛cryptomiscOSINT出题,难易程度循序渐进,下面记录一下本人题目题解(( 比赛网址:https://yuanshen.life/CRYPTOSuperbRSA(85支队伍攻克)题目CRYPTO真的很难吗?Ö_O不会吧不会吧!,一定要相信自己咩~出题人:Kicky_Mu#user:mumu666fromCrypto.Util.number......
  • Codeforces Round 927 (Div. 3)
    CodeforcesRound927(Div.3)C.LR-remaindersDescription给定一个长度为\(n\)的数组\(a\)和\(n\)个指令,每条指令为\(\texttt{L,R}\)中的一种。依次处理每个指令:首先,输出\(a\)中所有元素的乘积除以\(m\)的余数。然后,如果当前指令为\(\textttL\),则移除数组......
  • Codeforces Round 927 (Div. 3)
    A传送门  根据题意每一步只能走一步或者两步,很显然如果有连续的两个荆棘就不能走了,在不能走之前是一定可以把路上的金币全捡起来所以只需要边捡金币边判断是否能继续走下即可。#include<bits/stdc++.h>usingll=longlong;typedefstd::pair<int,int>PII;typedef......