UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#196327#973. 正圆也能做排序wyx1000ms1356kbC++504b2023-10-20 21:37:482023-10-20 21:37:49

answer

#include<bits/stdc++.h>
using namespace std;
#define PAI 3.14
struct circle
{
	string name;
	int r;
	double C,S;
};
circle a[1005];
int n;
bool cmp(circle a,circle b)
{
	return a.name<b.name;
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].name>>a[i].r;
		a[i].C=2*a[i].r*PAI;
		a[i].S=a[i].r*a[i].r*PAI;
	}
	sort(a,a+n,cmp);
	for(int i=0;i<n;i++)
		printf("%s %d %.1lf %.1lf\n",a[i].name.c_str(),a[i].r,a[i].C,a[i].S);
	return 0;
}

详细

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

Test #1:

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

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: 1356kb

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