2012-01-06から1日間の記事一覧

AOJ 0133 - Rotation of a Pattern

aoj

回転ってどうやるの?と思って調べてコードを書きました. しかし,それは逆回転だった. #include <iostream> #include <cstring> int main(){ char map[8][8],t_m[8][8]; for(int i=0;i<8;i++){ std::cin >> map[i]; } for(int i=1;i<4;i++){ //角度分(90,180,270)</cstring></iostream>…

AOJ 0148 - Candy and Class Flag

aoj

入力された数を39で割ったときの余りを使えばできる. ただ,余りが0になったとき39番がクラス旗を手に出来ます. #include <cstdio> int main(){ int n; while(~scanf("%d",&n)){ int res = n%39?n%39:39; printf(res<10?"3C0%d\n":"3C%d\n",res); } }</cstdio>

AOJ 0139 - Snakes

aoj

普通に解いた. #include <iostream> //任意文字を消し全て消えてるか調べる関数 int clear(std::string s, std::string f){ int pos; while(pos = s.find(f), pos != std::string::npos) s.replace(pos,f.size(),""); if(s == "")return 1; return 0; } int main(){ i</iostream>…

AOJ 0138 - Track and Field Competition

aoj

単なる実装.少数の時はprintfを使うと書きやすい事に気づきました. 今回の場合は,精度が必要無いのでfloatでもよさそうですね. #include <iostream> #include <algorithm> #include <cstdio> struct athlete{int num; double time;}; bool tsort(const athlete& l, const athlete& r){</cstdio></algorithm></iostream>…

AOJ 0135 - Clock Short hand and Long Hand

aoj

正答率28.2%だが,簡単でしょww.すいません嘘でした. まず,長針と短針の角度計算を間違えていた. 長針は時間の影響も受けることを忘れていました. 次の問題は,長針は30 * H(hour) + 0.5 * M(min)ではないことです. これは,各々で計算しているため…