2014-06-13から1日間の記事一覧

0025 - Hit and Blow

#include <iostream> using namespace std; void Slove(int a[]) { int b[4], hit=0, blow=0; for (int i=1; i<4; ++i) cin >> a[i]; for (int i=0; i<4; ++i) cin >> b[i]; for (int i=0; i<4; ++i) for (int j=0; j<4; ++j) if ( a[i] == b[j] ) { if (i == j) ++hit</iostream>…

0024 - Physical Experiments

#include <iostream> using namespace std; void Slove(double v) { int answer=0; double t=v/9.8, y=4.9*t*t; while (5*answer-5 <= (int)y) ++answer; cout << answer << endl; } int main(void) { double v; while (cin >> v) Slove(v); return 0; } 公式に当ては</iostream>…