2016-11-26から1日間の記事一覧

AOJ 0060 Card Game

カードゲーム | Aizu Online Judge 残りカードを引いた時の合計が20以下になる場合の数を7.0で割った商が0.5(50%)以上ならYES #include <iostream> using namespace std; int main() { int c1, c2, c3; while (cin >> c1) { cin >> c2 >> c3; int c[10] = { 0 }, sum =</iostream>…

AOJ 0059 Intersection of Rectangles

長方形の重なり | Aizu Online Judge #include <iostream> using namespace std; int main() { double ax, ay, bx, by, cx, cy, dx, dy; while (cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy) { if (ax > dx || bx < cx || ay > dy || by < cy) { cout << "NO</iostream>…

AOJ 0058 Orthogonal

直交 | Aizu Online Judge 内積が0の場合直交している。 #include <cstdio> #include <cmath> using namespace std; #define EPS 1e-10 int main() { double ax, ay, bx, by, cx, cy, dx, dy; while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&ax,&ay,&bx,&by,&cx,&cy,&dx,</cmath></cstdio>…

AOJ 0057 The Number of Area

最大の領域の数 | Aizu Online Judge n本の線を引いた時の領域の数はn-1本の線を引いた時の数とnの和と等しい #include <iostream> using namespace std; int main() { int n, a[10001] = { 0 }; a[0] = 1; for (int i = 1; i < 10001; i++) { a[i] = a[i - 1] + i; } </iostream>…

AOJ 0056 Goldbach's Conjecture

ゴールドバッハ予想 | Aizu Online Judge i番目とn-i番目の数が素数なら二つの和がnになるのでカウント #include <iostream> #include <numeric> using namespace std; #define SIZE 50001 int main() { bool prime[SIZE]; fill(prime, prime + SIZE, true); prime[0] = prime[1</numeric></iostream>…