#29413:


hogantina6@gmail.com (許宏源)

學校 : 不指定學校
編號 : 184258
來源 : [223.138.102.143]
最後登入時間 :
2022-04-12 20:22:22
d096. 00913 - Joana and the Odd Numbers -- UVa913 | From: [111.242.74.135] | 發表日期 : 2022-02-26 15:45

#include <stdio.h>

int main(){

    int x,n,X,S,S1,Ans;

    scanf("%d",&x);

    n=(x+1)/2;

    X=(2*1+(n-1)*2)*n/2;

    S=(2*1+(X-1)*2)*X/2;

    S1=(2*1+(X-4)*2)*(X-3)/2;

    Ans=S-S1;

    printf("%d\n",Ans);

    scanf("%d",&x);

    n=(x+1)/2;

    X=(2*1+(n-1)*2)*n/2;

    S=(2*1+(X-1)*2)*X/2;

    S1=(2*1+(X-4)*2)*(X-3)/2;

    Ans=S-S1;

    printf("%d\n",Ans);

    scanf("%d",&x);

    n=(x+1)/2;

    X=(2*1+(n-1)*2)*n/2;

    S=(2*1+(X-1)*2)*X/2;

    S1=(2*1+(X-4)*2)*(X-3)/2;

    Ans=S-S1;

    printf("%d\n",Ans);

    return 0;

}

 
ZeroJudge Forum