夢追い人

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

あんま精進してませぬな

UAPC2011Summer - A

#include <cstdio>
#include <iostream>
#include <vector>
#include <climits>
using namespace std;
typedef vector<int> vi;
struct ch {
	string name;
	vector<int> time;
	int pt;
	ch() { pt=0; }
};
int main() {
	int n, m, d;
	while (scanf("%d",&n)&&n!=0) {
		vi times(31, 0);
		ch names[n];
		for (int i=0; i<n; i++) {
			cin >> names[i].name;
			scanf("%d", &m);
			for (int j=0; j<m; j++) {
				int temp; scanf("%d", &temp);
				names[i].time.push_back(temp);
				times[temp]++;
			}
		}
		int res = INT_MAX;
		string rstr;
		for (int i=0; i<n; i++) {
			for (int j=0; j<names[i].time.size(); j++) {
				int pts = n;
				int cnt = times[names[i].time[j]];
				if (cnt==n) pts = 1;
				else if (cnt>1) pts -= cnt-1;
				names[i].pt += pts;
			}
			if ((names[i].pt < res)||(names[i].pt==res&&names[i].name<rstr)) {
				rstr = names[i].name;
				res = names[i].pt;
			}
		}
		cout << res << " " << rstr << endl;
	}
}

PKU - 2070

#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

int main() {
	float sp;
	int we, st;
	while (scanf("%f%d%d", &sp, &we, &st)) {
		if (sp == 0 && we == 0 && st == 0) break;
		vector<string> ans;
		if (sp <= 4.5 && we >= 150 && st >= 200) {
			ans.push_back("Wide Receiver");
		}
		if (sp <= 6.0 && we >= 300 && st >= 500) {
			ans.push_back("Lineman");
		}
		if (sp <= 5.0 && we >= 200 && st >= 300) {
			ans.push_back("Quarterback");
		}
		if (ans.size() == 0) {
			printf("No positions\n");
		} else {
			for (int i=0; i<ans.size()-1; i++) cout << ans[i] << " ";
			cout << ans[ans.size()-1] << endl;
		}
	}
}
広告を非表示にする