夢追い人

"It takes a dreamer to make a dream come true."―Vincent Willem van Gogh

個人的にやったもの

0077

#include <iostream>
using namespace std;
int main() {
	string str;
	while (cin >> str) {
		string res = "";
		for (int i=0; i<str.length(); i++) {
			if (str[i] == '@' && i+2 < str.length()) {
				int n = str[i+1] - '0';
				for (int j=0; j<n; j++) res += str[i+2];
				i+=2;
			} else {
				res += str[i];
			}
		}
		cout << res << endl;
	}
}

0074

#include <cstdio>

int main() {
	int res;
	int h, m, s;
	while (scanf("%d%d%d", &h, &m, &s)) {
		res = 120;
		if (h==-1&&m==-1&&s==-1) break;
		m += h * 60;
		res -= m;
		if (s != 0) {
			res--;
			s = 60 - s;
		}
		h = (int)(res / 60);
		m = res - h * 60;
//		printf("%d\n",res);
		printf("%02d:%02d:%02d\n", h, m, s);
		res *= 3;
		s *= 3;
		res += s / 60;
		s -= s / 60 * 60;
		h = (int)(res / 60);
		m = res - h * 60;
		printf("%02d:%02d:%02d\n", h, m, s);
	}
}

0073

#include <cstdio>
#include <cmath>
int main() {
	int x, h;
	while (scanf("%d%d", &x, &h)) {
		if (x == 0 && h == 0) break;
		double temp1 = sqrt(pow((double)h, 2) + pow((double)x*sqrt(2)/2, 2));
		double temp2 = sqrt(pow(temp1, 2) - pow((double)x/2, 2));
		double S = pow((double)x, 2) + 2.0 * temp2 * (double)x;
		printf("%.6f\n", S);
	}
}
広告を非表示にする