日々精進

aikoと旅行とプログラミング

競プロ

AtCoder Beginner Contest #61

問題はこちらから abc061.contest.atcoder.jp 問題A : Between Two Integers #include <iostream> using namespace std; int main(){ int a, b, c; cin >> a >> b >> c; cout << ((a <= c && c <= b)?"Yes":"No") << endl; } 問題B : Counting Roads #include<bits/stdc++.h> #define </bits/stdc++.h></iostream>…

AtCoder Beginner Contest #62

問題はこちらから. abc062.contest.atcoder.jp 問題A: Grouping #include <iostream> using namespace std; int main() { int x, y; int groups[] = {0, 1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1}; cin >> x >> y; cout << (groups[x] == groups[y]?"Yes":"No") << endl; }</iostream>…

AtCoder Beginner Contest #63

問題はこちらからどうぞ. abc063.contest.atcoder.jp 問題A: Restricted #include <iostream> using namespace std; int main(){ int a, b; cin >> a >> b; if(10 <= a + b) cout << "error" << endl; else cout << a + b << endl; } 問題B: Varied #include<bits/stdc++.h> #define r</bits/stdc++.h></iostream>…

AtCoder Beginner Contest #64

問題はこちらからどうぞ. abc064.contest.atcoder.jp 問題A: RGB Cards #include <iostream> using namespace std; int main(){ int r, g, b; cin >> r >> g >> b; cout << ((r * 100 + g * 10 + b)%4==0?"YES":"NO") << endl; } 問題B: Traveling AtCoDeer Problem #i</iostream>…

【POJ 1862】Stripies

問題 1862 -- Stripies 方針 入力された値を降順ソートする. 質量m1とm2の物体があった時, で求められるので, これを先頭から順にやっていく. コード #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<ctime> #include<cctype> #include<climits> #include<iostream> #include<string> #include<vector> #include<map> </map></vector></string></iostream></climits></cctype></ctime></cmath></cstring></cstdlib></cstdio>…

【AOJ 2102】Rummy

問題 Rummy | Aizu Online Judge 方針 数字と記号のペアが与えられるので, 全通り試してセットであるか試す. セットである条件は 3枚とも同じ色であること 番号がすべて同じか連番になっていること(ただし, 8, 9, 1のような連番は認められない) これが3枚3…

【ICPC World Final 2017】E : Need for Speed

問題 Need for Speed – Kattis, ICPC ある区間の距離と移動速度がそれぞれとして与えられる. は実際の速度s+c(cは定数)として表示されている. 実際にかかった時間tが与えられるので, cが何であるかを求めよ. 方針 となったときのCが答えとなる. 二分探索を行…

【AOJ 2015】Square Route

問題 Square Route | Aizu Online Judge 方針 道と道の間隔が与えられるので, 正方形の区画がいくつあるか数える問題 すべてのパターンを試す方法では, となり終わらない. そこで, 辺の長さの全パターンを予め求め, その出現個数を元に計算する.(この場合は…

【AOJ ALDS1_12】C: Graph Ⅱ - Single Source Shortest Path Ⅱ

問題 最短経路 | アルゴリズムとデータ構造 | Aizu Online Judge 方針 隣接行列を用いたダイクストラ法はグラフG=(V, E)においてとなる. 今回はノード数がであるので, 隣接リストを使った実装を行う. 隣接リストでグラフを表現し, 二分ヒープ(priority_queue…

【AOJ 1136】Polygonal Line Search

問題 Polygonal Line Search | Aizu Online Judge 方針 0番目の入力セットと1〜n番目までのセットを比較して同じ形の折れ線であるか判定する. 同じ折れ線であるかの判定は, 以下のいずれかを満たす. xy平面内で回転および平行移動によって(拡大縮小や裏返し…

【AOJ ALDS1_9】C: Heaps - Priority Queue

問題 優先度付きキュー | アルゴリズムとデータ構造 | Aizu Online Judge 方針 優先度付きキューを実装する問題 (体がしんどいので元気になったらしっかり書きます許して) コード #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<ctime> #include<cctype> #include<climits> #include<iostream></iostream></climits></cctype></ctime></cmath></cstring></cstdlib></cstdio>…

【AOJ 1167】Pollock's conjecture

問題 Pollock's conjecture | Aizu Online Judge 方針 動的計画法を使う. nを表現するのに必要な正四面体の数の最小値 としたとき, はとして求めることができる. 1から順番にもとめておき, 入力したnを添え字にしてテーブルを出力する. コード #include<iostream> #inc</iostream>…

【AOJ 1346】Miscalculation

問題 Miscalculation | Aizu Online Judge 方針 ルール1は通常の優先順位(乗算→加算)で演算する. ルール2は左から順番に計算する. ルール1とルール2の結果が等しく, 入力した数字とも等しければU ルール1が入力した数字と等しければM, ルール2と等しければ…