2012-12-31から1日間の記事一覧

ARC #001のA(センター採点)

Aなら解ける...はず.あと24分で新年ですね. #include<iostream> int main(){ int n; std::cin >> n; std::string str; std::cin >> str; int a[4] = {0}; for(int i=0;i</iostream>

AOJ 0059 - Intersection of Rectangles

aoj

色々やったんですがWAだったので,違う方法にしました. 重ならない方から調べます. #include<iostream> struct P{ double x, y; }; int main(){ P ps[4]; while(std::cin >> ps[0].x >> ps[0].y >> ps[1].x >> ps[1].y >> ps[2].x >> ps[2].y >> ps[3].x >> ps[3].y,</iostream>…

AOJ 0186 - Aizu Chicken

aoj

会津鶏肉の量で二分探索する. #include<iostream> #include<cstdio> const int INF = 1 << 24; int q_chicken, b, p_chicken, p_aizu, q_aizu; bool C(int x){//x: 買う会津鶏肉の量 if(x * p_aizu > b || x > q_aizu){//資金超えるか用意された量より多い return false; } re</cstdio></iostream>…

AOJ 0181 - Persistence

aoj

はじめての2分探索. #include<iostream> const int INF = 1 << 24; int m, n, a[100];//dansu, honsu bool C(double x){ int i = 0, j = 0, l = 0; while(i < n && j < m){ if(l + a[i] <= x){//入る l += a[i]; i++; }else{//もう入らない l = 0; j++; } } if(i == n</iostream>…