Entries from 2015-08-01 to 1 month

Topcoder SRM150 Div1 Level 1 InterestingDigits

問題 http://community.topcoder.com/stat?c=problem_statement&pm=1523&rd=4555解法 まだコード #include <bits/stdc++.h> #include <stdint.h> #include <sys/time.h> class InterestingDigits { public: std::vector<int> digits(int base) { int n = base - 1; std::vector<int> res; for(int i = 2; i <</int></int></sys/time.h></stdint.h></bits/stdc++.h>…

Topcoder SRM149 Div1 Level 1 BigBurger

問題 http://community.topcoder.com/stat?c=problem_statement&pm=1648&rd=4550解法 まだコード #include <bits/stdc++.h> #include <stdint.h> #include <sys/time.h> class BigBurger{ public: int maxWait(std::vector<int> arrival, std::vector<int> service) { int end[64]; int n = arrival.size(); </int></int></sys/time.h></stdint.h></bits/stdc++.h>…

Topcoder SRM148 Div1 Level 1 CircleGame

問題 http://community.topcoder.com/stat?c=problem_statement&pm=1735&rd=4545解法 0は飛び越えて,隣接する数の和が13になるものを0にしていく.コード #include <bits/stdc++.h> #include <stdint.h> #include <sys/time.h> class CircleGame { public: int cardsLeft(std::string deck) { int</sys/time.h></stdint.h></bits/stdc++.h>…

Topcoder SRM147 Div1 Level 1 PeopleCircle

問題 http://community.topcoder.com/stat?c=problem_statement&pm=1225&rd=4540解法 一旦すべての文字を'M'にしておく. この状態で,問題文の順番通りに'M'を'F'にしていけばいい. ただし,次に'F'にする場所を数えるときに,すでに'F'になっているところ…

Topcoder SRM146 Div1 Level 1 RectangularGrid

解法 数える長方形の幅をw,高さをhとすると, その大きさの長方形の個数は(width - w + 1) * (height - h + 1) これを2重ループで正方形でないもの(w != h)を数えればいいコード #include <bits/stdc++.h> #include <stdint.h> #include <sys/time.h> class RectangularGrid { public: long count</sys/time.h></stdint.h></bits/stdc++.h>…

Topcoder SRM145 Div1 Level 1 Bonuses

解法 問題文通りそれぞれの人のポイントの割合を求めた後, あまった分をpointsの値の大きい人から足していく. pointsの各値は1から500なので,2重ループにするとたぶん楽std::accumulateを初めて使ってみたコード #include <bits/stdc++.h> #include <cstdint> #include <sys/time.h> class Bon</sys/time.h></cstdint></bits/stdc++.h>…

Topcoder SRM144 Div1 Level 1 BinaryCode

解法 最初の数字から順番に決めていく 答えに0と1以外が入ってたら"NONE" 問題ないならそれが答えになるコード #include <bits/stdc++.h> #include <stdint.h> #include <sys/time.h> class BinaryCode { public: std::vector<std::string> decode(std::string message) { std::vector<std::string> res; res.push_back(solve</std::string></std::string></sys/time.h></stdint.h></bits/stdc++.h>…