• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 21, comments - 2, trackbacks - 0, articles - 0

            POJ 2273 An Excel-lent Problem

            Posted on 2011-09-05 21:53 acpeng 閱讀(487) 評(píng)論(0)  編輯 收藏 引用 所屬分類: ACM程序

            把整數(shù)轉(zhuǎn)化為excel對(duì)應(yīng)的列值http://poj.org/problem?id=2273
            Description

            A certain spreadsheet program labels the columns of a spreadsheet using letters. Column 1 is labeled as ``A", column 2 as ``B", ..., column 26 as ``Z". When the number of columns is greater than 26, another letter is used. For example, column 27 is ``AA", column 28 is ``AB" and column 52 is ``AZ". It follows that column 53 would be ``BA" and so on. Similarly, when column ``ZZ" is reached, the next column would be ``AAA", then ``AAB" and so on.

            The rows in the spreadsheet are labeled using the row number. Rows start at 1.

            The designation for a particular cell within the spreadsheet is created by combining the column label with the row label. For example, the upper-left most cell would be ``A1". The cell at column 55 row 23 would be ``BC23".

            You will write a program that converts numeric row and column values into the spreadsheet designation.

            Input

            Input consists of lines of the form: RnCm. n represents the row number [1,300000000] and m represents the column number, 1<=m<=300000000. The values n and m define a single cell on the spreadsheet. Input terminates with the line: R0C0 (that is, n and m are 0). There will be no leading zeroes or extra spaces in the input.

            Output

            For each line of input (except the terminating line), you will print out the spreadsheet designation for the specified cell as described above.

            Sample Input

            R1C1
            R3C1
            R1C3
            R299999999C26
            R52C52
            R53C17576
            R53C17602
            R0C0
            

            Sample Output

            A1
            A3
            C1
            Z299999999
            AZ52
            YYZ53
            YZZ53
            

            Source

            Greater New York 2004

            進(jìn)制轉(zhuǎn)化問(wèn)題,把列數(shù)改成26進(jìn)制輸出,分別用A,B...Z代替1,2,3...這里base[0]='Z',表示n與26余數(shù)為0時(shí)的取值,但進(jìn)位問(wèn)題需要注意,分余數(shù)是否為0兩種情況分析。
            代碼:
            #include<stdio.h>
            #define R 26
            char base[30]="ZABCDEFGHIJKLMNOPQRSTUVWXYZ";
            void fun(int N)
            {
                
            int i=0,j; char str[10];
                
            while(N>R)
                
            {
                    str[i
            ++]=base[N%R];
                    N
            =N%R==0?N/R-1:N/R;
                }

                str[i]
            =base[N];
                
            for(j=i;j>=0;j--)
                    printf(
            "%c",str[j]);
            }

            int main()
            {
                
            int m,n;
                
            while(scanf("%*c%d%*c%d",&m,&n)!=EOF)
                
            {
                    getchar();
                    
            if(m==0 && n==0)break;
                    fun(n);
                    printf(
            "%d\n",m);
                }

                
            return 0;
            }

            久久国产精品免费一区二区三区 | 久久精品国产亚洲AV无码娇色 | 久久久久久久久波多野高潮| 一本久久a久久精品综合夜夜 | 区久久AAA片69亚洲| 久久精品亚洲男人的天堂| 一本大道久久a久久精品综合| 97久久超碰国产精品2021| 久久综合狠狠综合久久综合88| 久久久久亚洲av成人网人人软件 | 18禁黄久久久AAA片| 久久久午夜精品福利内容| 亚洲欧美成人久久综合中文网| 一级做a爰片久久毛片看看| 国内精品伊人久久久久妇| 久久精品久久久久观看99水蜜桃| 久久人人添人人爽添人人片牛牛| 久久天天躁狠狠躁夜夜躁2014| 久久狠狠爱亚洲综合影院| 久久精品国产亚洲AV蜜臀色欲| 久久人人爽爽爽人久久久| 97久久精品午夜一区二区| 国产成人无码精品久久久免费| 久久精品国产亚洲Aⅴ香蕉 | 色成年激情久久综合| 久久精品这里只有精99品| 欧美国产成人久久精品| 91精品国产乱码久久久久久 | 久久久噜噜噜久久熟女AA片| 亚洲国产精品人久久| 亚洲精品无码久久久久AV麻豆| 色综合久久无码中文字幕| 97久久综合精品久久久综合| 91精品国产91久久久久久蜜臀| 午夜不卡久久精品无码免费| 久久天天躁狠狠躁夜夜avapp| 欧美精品国产综合久久| 亚洲精品高清国产一线久久| 香港aa三级久久三级| 久久久这里只有精品加勒比| 久久精品国产精品青草 |