POJ之路

來源:互聯網
上載者:User

聲明:作者是ACM初學者,列出的有些程式可能過於簡單,請大牛們無視之~~

THIS IS A TEST CODE:


1000.A+B Problem

#include<stdio.h>

int  main(){

    int a,b;

    scanf("%d,%d",&a,&b);

    printf("%d",a+b);

    return 0;

}

1003 Hangover

#include<stdio.h>
int main(){
double c;
    while(scanf("%lf",&c) && c!=0.00){
       //printf("%lf \n",c);
       float sum =0.0;
       int i;
       for(i=2;sum<c;i++){
      sum += (1.0/i);
       }
       printf("%d card(s)\n",i-2);
    }
    return 0;
}

1004 Financial Management

#include <stdio.h>
int main()
{   
float pay[12];
float sum;
int i;
sum = 0.00;
for (i = 0; i <= 11; i++)
{
scanf("%f", &pay[i]);
sum += pay[i];
}
printf("$%.2f\n", sum/12);
return 0;
}


1005 I Think I Need a Houseboat

#include <stdio.h>
#include <math.h>
int main()
{
int count;
double x,y;
scanf("%d",&count);
int i;
for(i=0;i<count;i++)
{
scanf("%lf %lf",&x,&y);
int year = (int)ceil((x*x+y*y)*3.14/100);
printf("Property %d: This property will begin eroding in year %d.\n",i+1,year);
}
printf("END OF OUTPUT.\n");
return 0;
}

1006 Biorhythms

#include <stdio.h>
int get_m(int a, int b, int c)
{
    int ab, ab_r;
    int i, j;
    ab = a*b;
    ab_r = ab%c;
    j = ab;
    for(i = 0; i < c; i ++){
        if(ab % c == 1)
            return ab;
        else
            ab += j;
    }
    return -1;
}

int main()
{
int p, e, i, start, case_count = 0;
int tmp;
while(scanf("%d %d %d %d", &p, &e, &i, &start) != EOF){
if(start == -1){
break;
}
case_count++;
tmp = (p*get_m(28, 33, 23) + e*get_m(23, 33, 28) + i*get_m(23, 28, 33))%21252;
printf("Case %d: the next triple peak occurs in %d days.\n", case_count, (tmp > start) ? (tmp-start):(tmp+21252-start) );
}
return 0;
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.