草庐IT

Beginner

全部标签

AtCoder Beginner Contest 300

A-N-choicequestion(abc300a)题目大意给定一个元素互不相同的数组\(c\)和\(a,b\),找到\(i\)使得\(c_i=a+b\)解题思路直接for循环寻找即可。神奇的代码#includeusingnamespacestd;usingLL=longlong;intmain(void){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);intn,a,b;cin>>n>>a>>b;for(inti=0;i>c;if(c==a+b){coutB-SameMapintheRPGWorld(abc300b)题目大意给定两个矩阵

AtCoder Beginner Contest 344

A-Spoiler(abc344A)题目大意给定一个字符串,包含两个|,将|和两个|之间的字符消去。解题思路按照题意模拟即可。Python比较简洁。神奇的代码s=input().split('|')s=s[0]+s[2]print(s)B-Delimiter(abc344B)题目大意给定\(n\)个数,倒序输出。解题思路储存这\(n\)个数,然后倒着输出即可。神奇的代码#includeusingnamespacestd;usingLL=longlong;intmain(void){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);vector

AtCoder Beginner Contest 342

A-Yay!(abc342A)题目大意给定一个字符串,两个字符,其中一个只出现一次,找出它的下标。解题思路看第一个字符出现次数,如果是\(1\)则就是它,否则就是不是它的字符。神奇的代码#includeusingnamespacestd;usingLL=longlong;intmain(void){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);strings;cin>>s;if(s.find(s[0],1)==string::npos){coutB-Whichisahead?(abc342B)题目大意一排人。\(m\)个询问,每个询问问两

KAJIMA CORPORATION CONTEST 2024(AtCoder Beginner Contest 340)ABCDEF 视频讲解

这场比较郁闷,C题短路,连续4次WA,导致罚时太多A-ArithmeticProgressionProblemStatementPrintanarithmeticsequencewithfirsttermAAA,lasttermBBB,andcommondifferenceDDD.Youareonlygiveninputsforwhichsuchanarithmeticsequenceexists.Constraints1≤A≤B≤1001\leqA\leqB\leq1001≤A≤B≤1001≤D≤1001\leqD\leq1001≤D≤100Thereisanarithmeticsequen

AtCoder Beginner Contest 341

A-Print341(abc341A)题目大意给定\(n\),输出\(n\)个\(0\)和\(n+1\)个\(1\)交替的字符串。解题思路\(101010...\)循环输出即可。神奇的代码n=input()s="10"*int(n)+"1"print(s)B-ForeignExchange(abc341B)题目大意货币兑换。\(A\)国货币每\(x_a\)钱可兑换\(B\)国货币\(y_a\)钱。\(B\)国货币每\(x_b\)钱可兑换\(C\)国货币\(y_b\)钱。...给定你拥有的每国货币钱数和兑换规则,依次兑换,问兑换到最后的国的货币数量。解题思路按照题意,按照上述规则一国一国模拟地兑

AtCoder Beginner Contest 340

A-ArithmeticProgression(abc340A)题目大意给定等差数列的首项、末项、公差。输出这个等差数列。解题思路从首相依次累加公差到末项即可。神奇的代码#includeusingnamespacestd;usingLL=longlong;intmain(void){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);inta,b,d;cin>>a>>b>>d;while(aB-Append(abc340B)题目大意依次进行\(Q\)次操作,分两种。1x,将x放到数组\(a\)的末尾。2k,输出数组\(a\)的倒数第\(k\)项

AtCoder Beginner Contest 338

A-Capitalized?(abc338A)题目大意给定一个字符串,问是否满足下述条件:第一个字母大写其余字母小写解题思路逐位判断即可。也可以将字符串变成上述形式,然后判断与原串是否相等。神奇的代码#includeusingnamespacestd;usingLL=longlong;intmain(void){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);strings;cin>>s;autot=s;t[0]=toupper(t[0]);transform(t.begin()+1,t.end(),t.begin()+1,::tolowe

AtCoder Beginner Contest 336 C - Even Digits题解

C-EvenDigits EditorialTimeLimit:2sec/MemoryLimit:1024MBScore: 300300 pointsProblemStatementAnon-negativeinteger �n iscalleda goodinteger whenitsatisfiesthefollowingcondition:Alldigitsinthedecimalnotationof �n areevennumbers(00, 22, 44, 66,and 88).Forexample, 00, 6868,and 20242024 aregoodintegers.You

AtCoder Beginner Contest 337

A-Scoreboard(abc337A)题目大意给定\(n\)场比赛高桥和青木的得分。问最后是总分,是高桥高还是青木高,还是打平了。解题思路累计比较大小即可。神奇的代码#includeusingnamespacestd;usingLL=longlong;intmain(void){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);intn;cin>>n;LLa=0,b=0;while(n--){intx,y;cin>>x>>y;a+=x;b+=y;}if(a>b)coutB-ExtendedABC(abc337B)题目大意给定一个字符串,问

AtCoder Beginner Contest 336

A-LongLoong(abc336A)题目大意给定一个数\(n\),将long中的o重复\(n\)次后输出。解题思路模拟即可。神奇的代码#includeusingnamespacestd;usingLL=longlong;intmain(void){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);intn;cin>>n;coutB-CTZ(abc336B)题目大意给定一个数\(n\),问\(n\)的二进制表示下的末尾零的数量。解题思路即找到最小的\(i\)使得\(n&(1不为零的位置。枚举即可。或者直接用内置函数__builtin_ctz