I think i need a houseboot C语言 UVA2363
生活随笔
收集整理的這篇文章主要介紹了
I think i need a houseboot C语言 UVA2363
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
使用題給數據計算出面積,然后向上取整,若向下取整會提前1年失去土地。
然后使用一個for循環得到失去土地的時間
1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 5 int main(void){ 6 int n,i,j; 7 int s; 8 double pi=3.1415926; 9 double *x,*y; 10 double r; 11 while(scanf("%d",&n)==1){ 12 x=(double *)malloc(n*sizeof(double)); 13 y=(double *)malloc(n*sizeof(double)); 14 for(i=0;i<n;i++) scanf("%lf %lf",&x[i],&y[i]); 15 for(i=0;i<n;i++){ 16 r=sqrt(x[i]*x[i]+y[i]*y[i]); 17 s=(int)(pi*r*r/2); 18 for(j=1;s>j*50;j++); 19 printf("Property %d: This property will begin eroding in year %d.\n",i+1,j); 20 } 21 printf("END OF OUTPUT."); 22 } 23 return 0; 24 } View Code?
轉載于:https://www.cnblogs.com/20174317zhuyuan/p/9387860.html
總結
以上是生活随笔為你收集整理的I think i need a houseboot C语言 UVA2363的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html的分类与特点
- 下一篇: themeleaf跳转锚链接