2020-01-01から1ヶ月間の記事一覧

AtCoder ABC-151 C問題Welcome to AtCoder

atcoder.jp 方針 ACに着目して条件分岐。ACになる過程でWAをカウントアップしていきました。 そして対象の問題がACになってたらcontinue。 ぼくはACとWAに関するテーブル(初期値-1)を作成してACになったらFLAG[p[i]-1][0]=1にして解きました。 #include <stdio.h> #</stdio.h>…

AtCoder ABC-151 B問題Achieve the Goal

atcoder.jp 方針 あと何点とればいいのか、なので逆算して求めることができます。 X = M*N-(a[0]+ … +a[i-1])みたいな感じ... あとはXが満点を超えてないかとか0点でもいいのかについて条件分岐してあげるだけ。 #include <stdio.h> #include <bits/stdc++.h> #include <iostream> using namesp</iostream></bits/stdc++.h></stdio.h>…

AtCoder ABC-151 A問題Next Alphabet

atcoder.jp 方針 アルファベットを順番に配列に格納。 入力した文字に対して走査し、i+1番目を出力します。 #include <stdio.h> #include <bits/stdc++.h> #include <iostream> using namespace std; int main() { char a[27]="abcdefghijklmnopqrstuvwxyz"; //char s[1]; char s; scanf("%c", </iostream></bits/stdc++.h></stdio.h>…

AtCoder ABC-149 D問題 Prediction and Restriction

https://atcoder.jp/contests/abc149/tasks/abc149_d 方針 とにかくじゃんけんに勝つ。 K手前と同じ手は出せないのでこの場合は邪魔しないように適当な手を出しておく(nとか) #include <stdio.h> #include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int n, k, </iostream></bits/stdc++.h></stdio.h>…