Codeforces Beta Round #1(A,B)

來源:互聯網
上載者:User

A水題,,,求n*m的矩形需要幾塊a*a才能覆蓋完.水題。

注意要用long long

int main(){    LL n,m,a;    while(~scanf("%I64d%I64d%I64d",&n,&m,&a)){            LL num1=0;            num1=n/a;            if(n%a!=0) num1++;            LL num2=0;            num2=m/a;            if(m%a!=0) num2++;            printf("%I64d\n",num1*num2);    }   return 0;}

B 題噁心的字串

這個 ,,,,嗚嗚嗚嗚,,,中間一次他拒絕了我好幾次,我就貼了下別人的代碼看看有沒有問題...最後終於130ms過了.

int main(){    int n;    char A[105],B[105],C[105],D[105];    int num,num1;    while(~scanf("%d",&n)){        while(n--){            scanf("%s",A);            int i=0;            num=0;            num1=0;            bool flag=false;            int len=strlen(A);            if(A[0]=='R') flag=true;            if(flag){                for(i=2;i<len;i++){                    if(A[i]=='C'&&(A[i-1]<='9'&&A[i-1]>='0')) break;                }                if(i==len) flag=false;            }            if(flag){                i=1;                while(A[i]>='0'&&A[i]<='9'){                    num=num*10+A[i]-'0';                    i++;                }                num1=0;                i++;                while(A[i]>='0'&&A[i]<='9'){                    num1=num1*10+A[i]-'0';                    i++;                }                i=0;                int temp=num1;                int m=0;                while(temp){                    //printf("m:%d\n");                    C[i]=temp%26+'A'-1-m;                    if(m==1&&temp==1) break;                    m=0;                    //printf("C:%c\n",C[i]);                    if(C[i]<'A'){                        C[i]='Z'+C[i]-'@';                        m=1;                    }                   // printf("%d %d %c %d\n",i,temp%26,C[i],m);                    i++;                    temp/=26;                }                C[i]='\0';                for(int j=i-1;j>=0;j--){                    if(C[j]>='A'&&C[j]<='Z')                    printf("%c",C[j]);                }               printf("%d\n",num);            }            else {                int i=0;                num=0;                while(A[i]>='A'&&A[i]<='Z'){                    num=num*26+(A[i]-'A'+1);                    i++;                }                int num1=0;                while(A[i]>='0'&&A[i]<='9'){                    num1=num1*10+A[i]-'0';                    i++;                }                printf("R%dC%d\n",num1,num);            }        }    }    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.