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

0007 - Debt Hell / AizuOnlineJudge

問題 : 借金地獄 | Aizu Online Judge #include <iostream> using namespace std; void Solve(int n) { int money=100000; for (int i=0; i<n; ++i) { money*=1.05; if (money%1000) { money/=1000; money*=1000; money+=1000; } } cout << money << endl; } int main(void) { int n; cin >> n; Solve(n); return 0; } 1000円未満の場合…</n;></iostream>

0006 - Reverse Sequence / AizuOnlineJudge

問題 : 文字列を逆順に出力 | Aizu Online Judge #include <algorithm> #include <iostream> #include <string> using namespace std; void Solve(string str) { reverse( str.begin(),str.end() ); cout << str << endl; } int main(void) { string str; cin >> str; Solve(str); return </string></iostream></algorithm>…

0005 - GCD and LCM / AizuOnlineJudge

問題 : 最大公約数と最小公倍数 | Aizu Online Judge #include <algorithm> #include <iostream> using namespace std; int GCD(int a, int b) { return (b > 0)? GCD(b,a%b) : a; } int LCM(int a, int b) { return a/GCD(a,b)*b; } void Solve(int a, int b) { if (a < b) swap(</iostream></algorithm>…

0004 - Simultaneous Equation / AizuOnlineJudge

問題 : 連立方程式 | Aizu Online Judge #include <cmath> #include <cstdio> #include <iostream> using namespace std; #define EPS 1e-10 void Solve(double a, double b, double c, double d, double e, double f) { double xx=c*d-a*f, xy=b*d-a*e, yy=b*f-c*e, x=yy/xy, y=xx/xy</iostream></cstdio></cmath>…