2013-04-06から1日間の記事一覧

0.1から始めるプログラミング 競技のほう aoj10017

#include <cstdio> #include <iostream> using namespace std; int main(){ while(1){ int n,x,cunt=0; cin >> n >> x; if(n==0&&x==0)break; for(int i=1;i</iostream></cstdio>

0.1から始めるプログラミング 競技ほう aoj10016

#include <cstdio> #include <iostream> using namespace std; int main(){ while(1){ int m,f,r; cin >> m >> f >> r; if(m==-1&&f==-1&&r==-1)break; if(m==-1||f==-1) cout << "F" << endl; else if(m+f>=80) cout << "A" << endl; else if(m+f>=65&&m+f<80) cout << "B" <<</iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10015

#include <cstdio> #include <iostream> #include <cmath> using namespace std; int main(){ int cards[4][13]; for (int i=0;i<4;i++){ for (int j=0;j<13;j++){ cards[i][j] = 0; } } int n; cin >> n; for (int i=0;i<n;i++){ char M; int m,num; cin >> M >> num; if(M=='S') m=0; else if(M=='H') m=1; else if(M=</n;i++){></cmath></iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10014

#include <cstdio> #include <iostream> #include <cmath> using namespace std; int main(){ int H,W; while(1){ cin >> H >> W; if(H==0&&W==0)break; for(int h=0;h</cmath></iostream></cstdio>

0.1から始めるプログラミング 競技のほう aoj10013

#include <cstdio> #include <iostream> #include <cmath> using namespace std; int main(){ int H,W; while(1){ cin >> H >> W; if(H==0&&W==0)break; for(int h=0;h</cmath></iostream></cstdio>

0.1から始めるプログラミング 競技のほう aoj10012

#include <cstdio> #include <iostream> #include <cmath> using namespace std; int main(){ int H,W; while(1){ cin >> H >> W; if(H==0&&W==0)break; for(int h=0;h</cmath></iostream></cstdio>

0.1から始めるプログラミング 競技のほう aoj10011

#include <cstdio> #include <iostream> #include <cmath> using namespace std; int main(){ int n; cin >> n; int array[100]; //逆から配列に入れてる for(int i = 1;i<n+1;i++){ cin >> array[n-i]; } //そして出力。配列が0originだから上と下でiの開始数字が違くてちょっとややこしい。 for(int </n+1;i++){></cmath></iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10010

#include <cstdio> #include <iostream> #include <cmath> using namespace std; int main(){ int a,b; char op; while(1){ cin >> a >> op >> b; if(op=='?') break; else if(op=='+') cout << a + b << endl; else if(op=='-') cout << a - b << endl; else if(op=='*') cout << a *</cmath></iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10009

#include <cstdio> #include <iostream> #include <cmath> using namespace std; int main(){ double r; cin >> r; printf("%f %f\n",r*r*M_PI,r*2*M_PI); return 0; } これもcoutしたらダメでした かなり精度微妙らしい あと、πは<cmath>にあるM_PIという定数を使用。どこまで桁数あるんかは</cmath></cmath></iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10008

間違い例 #include <cstdio> #include <iostream> using namespace std; int main(){ int a,b; cin >> a >> b; cout << a / b << " " << a % b << " "; double a_d = a; cout << a_d / b << endl; return 0; } これではサンプルの半分しか通れなかった。最後の計算の精度が問題</iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10007

#include <cstdio> #include <iostream> using namespace std; int main(){ while(1){ int x,y; cin >> x >> y; if(x==0&&y==0)break; cout << min(x,y) << " " << max(x,y) << endl; } return 0; } max(),min()使うのにいるかなぁと思って足すの忘れてたらそのまま通ったので</iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10006

#include <cstdio> #include <iostream> using namespace std; int main(){ for(int i=1;;i++){ int tmp; cin >> tmp; if(tmp==0)break; cout << "Case " << i << ": " << tmp << endl; } return 0; } 最初while+カウント変数とか使ってたけどそれってforですねはい なんか配列</iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10005

#include <cstdio> #include <iostream> using namespace std; int main(){ for(int i = 0;i<1000;i++){ cout << "Hello World" << endl; } return 0; } コメントは控えさせて頂きます</iostream></cstdio>

0.1から始めるプログラミング 競技のほう aoj10004

#include <cstdio> #include <iostream> #include <algorithm> using namespace std; int main(){ int array[3]; for(int i = 0;i<3;i++){ int tmp; cin >> tmp; array[i] = tmp; } sort(array,array+3); for(int i = 0;i<3;i++){ if(i==2) cout << array[i] << endl; else cout << array[</algorithm></iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10003

#include <cstdio> #include <iostream> using namespace std; int main(){ int a,b; cin >> a >> b; if(a>b) cout << "a > b" << endl; else if (a==b) cout << "a == b" << endl; else cout << "a < b" << endl; return 0; } コメント さすがに通すよ、、、(コピペするときn</iostream></cstdio>…

0.1から始めるプログラミング 競技のほう aoj10002

#include <cstdio> #include <iostream> int main(){ int a,b; cin >> a >> b; cout << a*b << " " << 2*(a+b) << endl; return 0; } コメント " "であっててよかった。 特に言うことは</iostream></cstdio>

0.1から始めるプログラミング 競技のほう aoj10001

#include <cstdio> #include <iostream> using namespace std; int main(){ int x; cin >> x; cout << x*x*x << endl; return 0; } コメント 標準入出力は出揃った。 cin,coutは簡単でいいんだけど後々入力が死ぬほどだるくなってくることを知ってるからな… 正直思う通りの入力</iostream></cstdio>…