UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#171346#973. 正圆也能做排序heyuzhen1000ms1352kbC++603b2023-06-22 21:50:492023-06-22 21:50:51

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dou double
struct node{
	string m;
	ll b;
	double c,s;
	void check(){
		c = 6.28 * b;
		s = 3.14 * b * b;
	}
	bool operator < (const node t) const{
		return m < t.m;
	}
	void print(){
		cout << m << " " << b << " ";
		printf("%.1f %.1f",c,s);
		cout << endl;
	} 
}a[1005];
ll n;
int main(){
//	freopen("data01.txt","r",stdin);
	cin >> n;
	for(ll i = 1;i <= n;i++){
		cin >> a[i].m >>a[i].b;
		a[i].check();
	} 
	sort(a + 1,a + n + 1);
	for(ll i = 1;i <= n;i++)
		a[i].print();
	return 0;
}



Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 33
Accepted
time: 0ms
memory: 1340kb

input:

3
c1 3
c2 5
c3 3

output:

c1 3 18.8 28.3
c2 5 31.4 78.5
c3 3 18.8 28.3

result:

ok 3 lines

Test #2:

score: 33
Accepted
time: 0ms
memory: 1340kb

input:

5
x 5
a 4
c 2
z 3
b 3

output:

a 4 25.1 50.2
b 3 18.8 28.3
c 2 12.6 12.6
x 5 31.4 78.5
z 3 18.8 28.3

result:

ok 5 lines

Test #3:

score: 33
Accepted
time: 0ms
memory: 1352kb

input:

3
abd 4
bda 5
abc 3

output:

abc 3 18.8 28.3
abd 4 25.1 50.2
bda 5 31.4 78.5

result:

ok 3 lines