Skip to content

Instantly share code, notes, and snippets.

@henrybear327
Last active August 29, 2015 14:07
Show Gist options
  • Save henrybear327/37d0fbbe64a2216957e6 to your computer and use it in GitHub Desktop.
Save henrybear327/37d0fbbe64a2216957e6 to your computer and use it in GitHub Desktop.
ACM10499.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
long long int equal_parts;
while(scanf("%lld", &equal_parts) != EOF)
{
if(equal_parts < 0)
break;
else if(equal_parts == 1)
printf("0%%\n");
else
printf("%lld%%\n", equal_parts * 25);
}
return 0;
}
/*
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=16&problem=1440&mosmsg=Submission+received+with+ID+14345881
Coding reference
http://nc-oj.logdown.com/posts/2011/12/26/acm-10499-land-of-justice
http://olia14.pixnet.net/blog/post/12933913-c-acm-10499-the-land-of-justice
球體表面積公式為 4*π*R*R
1.如果切成 一半,可以想像多兩個大圓面積 為2*(R*R*π)
==>2*(R*R*π) /4*π*R*R =50%
2.如果球體等分成3塊, 表面積會多 6*(1/2*R*R*π) (想像每個切面都是1/2個大圓面積)
==>3*(R*R*π) /4*π*R*R =75%
3.如果球體等分成3塊, 表面積會多 8*(1/2*R*R*π)
==>4*(R*R*π) /4*π*R*R =100%
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment