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

テレワーク用の環境構築(デスクとか)

はじめに 昨今の事情により、自宅で勤務する人が多くなってきたかと思います。 実は私も事務所が出禁になってしまい、、、4月は1日大阪出張に行ったぐらいであとは全部自宅で働いてました。 一応、私の部屋には大き目のL字デスクや椅子があったのですが、個…

AtCoder ABC-164 C - gacha

atcoder.jp 方針 最初、C++でやってたんですけど入力した途端にセグフォが出てしまったのでやむなしでpython... 入力した文字をリストに突っ込んでいって、そのリスト内に初めて出てきたらカウントアップするのが王道だと思いますが この方法でやるとTLEにな…

AtCoder ABC-164 B - Battle

atcoder.jp 方針 高橋くん、青木くんという順番で攻撃することに注意。 体力、攻撃力が2人とも同じだったら高橋くんが勝ちになるので条件分岐を先にいれています。 #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; #define lli long ling int; int main</iostream></stdlib.h></stdio.h>…

AtCoder ABC-164 A - Sheep and Wolves

atcoder.jp 方針 入力した文字について条件分岐するだけ! #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; #define lli long ling int; int main() { int S, W; scanf("%d %d", &S, &W); if(W>=S) { printf("unsafe\n"); return 0; } else { printf("s</iostream></stdlib.h></stdio.h>…

AtCoder ABC-161 B - Popular Vote

atcoder.jp 方針 得票数を合算して総得票数を出します。 そのあと、総得票数の1/4Mについて判定するんですけど割り算の挙動が怖かったので掛け算に置き換えました。 #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; #define lli long ling int; int mai</iostream></stdlib.h></stdio.h>…

AtCoder ABC-161 A - ABC Swap

グラブルで古戦場が始まってしまったので今日は1問だけ...(しかもA問題) atcoder.jp 方針 変数の入れ替えですね、tmp変数用意して入れ替えます。 (ネットでswap関数コピーしてくるのが手っ取り早い) #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std;</iostream></stdlib.h></stdio.h>…

AtCoder ABC-162 C - Sum of gcd of Tuples (Easy) /

atcoder.jp 方針 3つの整数に対してユークリッドの互除法を使いました。 3重ループは時間がかかるので非推奨ですが... #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; #define lli long ling int; int gcd(int a, int b) { int r; r = a % b; while(r!</iostream></stdlib.h></stdio.h>…

AtCoder ABC-162 B - FizzBuzz Sum

atcoder.jp 方針 FizzBuzz!! FizzとBuzz以外を足していきました。オーバーフロー対処にはlong long int使いました笑 #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; #define lli long ling int; int main() { long long int N, sum = 0; scanf("%lld</iostream></stdlib.h></stdio.h>…

AtCoder ABC-162 A - Lucky 7

atcoder.jp 方針 商と余りに着目。余りが7だったらYes。 入力の仕様が3桁だったので同じ処理を2回書きました... #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; #define lli long ling int; int main() { int N; scanf("%d", &N); int a, b; a = N / 1</iostream></stdlib.h></stdio.h>…

最近やりたいこと

グラブル Signate Atcoder Jetson nanoいじり倒す できるかな。。。特にJetsonはTRTとDeepStreamやりたいな。。。

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>…