青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

ACM___________________________

______________白白の屋
posts - 182, comments - 102, trackbacks - 0, articles - 0
<2010年9月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

常用鏈接

留言簿(24)

隨筆分類(332)

隨筆檔案(182)

FRIENDS

搜索

積分與排名

最新隨筆

最新評論

閱讀排行榜

評論排行榜

HDOJ 2714 HDU 2714 ISBN ACM 2714 IN HDU

Posted on 2010-09-25 20:25 MiYu 閱讀(458) 評論(1)  編輯 收藏 引用 所屬分類: ACM ( 水題 )

MiYu原創, 轉帖請注明 : 轉載自 ______________白白の屋    

題目地址 :

http://acm.hdu.edu.cn/showproblem.php?pid=2714

題目描述:

ISBN

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 566    Accepted Submission(s): 172


Problem Description
Farmer John's cows enjoy reading books, and FJ has discovered that his cows produce more milk when they read books of a somewhat intellectual nature. He decides to update the barn library to replace all of the cheap romance novels with textbooks on algorithms and mathematics. Unfortunately, a shipment of these new books has fallen in the mud and their ISBN numbers are now hard to read.

An ISBN (International Standard Book Number) is a ten digit code that uniquely identifies a book. The first nine digits represent the book and the last digit is used to make sure the ISBN is correct. To verify that an ISBN number is correct, you calculate a sum that is 10 times the first digit plus 9 times the second digit plus 8 times the third digit ... all the way until you add 1 times the last digit. If the final number leaves no remainder when divided by 11, the code is a valid ISBN.

For example 0201103311 is a valid ISBN, since
10*0 + 9*2 + 8*0 + 7*1 + 6*1 + 5*0 + 4*3 + 3*3 + 2*1 + 1*1 = 55.

Each of the first nine digits can take a value between 0 and 9. Sometimes it is necessary to make the last digit equal to ten; this is done by writing the last digit as X. For example, 156881111X is a valid ISBN number.

Your task is to fill in the missing digit from a given ISBN number where the missing digit is represented as '?'.
 

Input
* Line 1: A single line with a ten digit ISBN number that contains '?' in a single position
 

Output
* Line 1: The missing digit (0..9 or X). Output -1 if there is no acceptable digit for the position marked '?' that gives a valid ISBN.
 

Sample Input
15688?111X
 

Sample Output
1
 

Source
 

 

題目分析 :

水題, 不錯還是 WA 了2次 , 很郁悶 , 主要是沒有注意到 題目描述中點一句話 :

Each of the first nine digits can take a value between 0 and 9. Sometimes it is necessary to make the last digit equal to ten; this is done by writing the last digit as X. For example, 156881111X is a valid ISBN number.

這句話是關鍵 , 意思就是 除了最后一個數字 可能是 X 外  其他的都只能為 0-9的數字.

 

代碼如下 :

 /*

Coded By  : MiYu

Link      : http://www.cnblogs.com/MiYu  || http://m.shnenglu.com/MiYu

Author By : MiYu

Test      : 1

Program   : 2714

*/

//#pragma warning( disable:4789 )

#include <iostream>

#include <algorithm>

#include <string>

#include <set>

#include <map>

#include <utility>

#include <queue>

#include <stack>

#include <list>

#include <vector>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <cmath>

using namespace std;

int main ()

{

    string str;

    while ( cin >> str )

    {

          int N = str.size();

          int sum = 0, ask = 0;

          for ( int i = 1; i <= N; ++ i )

          {

               switch ( str[i-1] )

               {

                       case 'X':

                                sum += (10-i+1) * 10;  break;

                       case '?':

                                ask = 10-i+1;  break;

                       default :

                                sum += (10-i+1) * (str[i-1] - '0');  break;      

               }

          } 

          int pos = -1;

          for ( int i = 0; i <= 10; ++ i )  

          {

               if ( ( sum + ask * i ) % 11 == 0 )

               {

                    pos = i;

                    break;     

               }    

          } 

          if ( ask != 1 && pos == 10 ) pos = -1; //沒有這句代碼 WA  2次  很郁悶.

          if ( pos == 10 )

             cout << 'X' << endl;  

          else

              cout << pos << endl;

    }

    return 0;

}


 

Feedback

# re: HDOJ 2714 HDU 2714 ISBN ACM 2714 IN HDU  回復  更多評論   

2012-03-09 21:40 by ACM小鳥~
謝謝 你的慷慨幫助。
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            欧美成人日韩| 久久精品亚洲| 国产精品第一页第二页第三页| 亚洲韩国一区二区三区| 欧美激情亚洲自拍| 欧美日韩在线播放三区四区| 亚洲欧美国产精品桃花| 欧美一区二区三区在线| 亚洲国产精品成人精品| 亚洲欧洲一区二区在线观看| 欧美日韩一区二区在线视频 | 欧美11—12娇小xxxx| 亚洲精品影院在线观看| 亚洲一区二区伦理| 激情综合网址| 99成人在线| 韩国一区二区三区在线观看| 91久久久亚洲精品| 国产欧美va欧美不卡在线| 免费视频亚洲| 国产精品一二三四| 欧美激情欧美狂野欧美精品| 国产精品乱码一区二三区小蝌蚪| 久久色在线播放| 欧美日韩直播| 免费久久久一本精品久久区| 欧美视频中文字幕| 欧美国产视频在线观看| 国产精品色婷婷久久58| 亚洲欧洲精品一区| 精品福利免费观看| 在线视频欧美精品| 亚洲国产精品激情在线观看| 亚洲欧美清纯在线制服| 日韩亚洲精品电影| 久久久久高清| 欧美一区亚洲一区| 欧美视频免费| 91久久久久久国产精品| 伊人成综合网伊人222| 亚洲伊人伊色伊影伊综合网| 日韩午夜剧场| 免费看的黄色欧美网站| 久久久亚洲精品一区二区三区| 欧美四级剧情无删版影片| 亚洲国产第一| 亚洲国产精品va在线看黑人动漫| 午夜久久黄色| 欧美一乱一性一交一视频| 欧美日韩黄色一区二区| 欧美国产精品日韩| 精品999日本| 久久av一区二区三区漫画| 午夜精品一区二区三区电影天堂 | 亚洲综合二区| 性欧美video另类hd性玩具| 欧美午夜电影在线观看| 99国产精品久久久| 99视频精品全国免费| 欧美国产在线电影| 亚洲国产视频一区| 亚洲伦理一区| 欧美精品一区二区三区久久久竹菊| 女人色偷偷aa久久天堂| 在线观看日韩精品| 六十路精品视频| 亚洲高清免费| 99re热精品| 欧美日韩综合一区| 亚洲宅男天堂在线观看无病毒| 亚洲免费视频一区二区| 国产精品久久一区主播| 午夜精品久久久久久久久久久久久| 亚洲一区二区三区四区在线观看| 欧美日韩综合在线| 亚洲综合日韩在线| 久久久一二三| 最近看过的日韩成人| 欧美精品久久久久a| 亚洲特黄一级片| 欧美一区二区三区视频在线| 激情伊人五月天久久综合| 久久亚洲综合色| 亚洲精品一区二区三区99| 亚洲在线观看| 狠狠色丁香婷婷综合久久片| 欧美黄色日本| 亚洲综合导航| 亚洲第一精品福利| 亚洲免费伊人电影在线观看av| 国产日韩亚洲欧美| 免费成人美女女| 亚洲网站在线观看| 免费久久99精品国产自在现线| 99re66热这里只有精品3直播| 国产精品五区| 欧美成人精品福利| 亚洲欧美色婷婷| 亚洲高清视频中文字幕| 午夜精品999| 亚洲人体1000| 国产日韩综合| 欧美日韩综合一区| 老司机精品视频网站| 亚洲午夜影视影院在线观看| 欧美国产日本| 久久九九国产精品| 亚洲少妇中出一区| 亚洲国产99| 国产一区二区三区在线免费观看| 欧美日韩精品免费观看视频完整| 久久成人国产精品| 亚洲视频在线观看| 亚洲日本电影| 欧美激情亚洲国产| 久久人人超碰| 久久精品成人一区二区三区| 这里只有精品视频| 亚洲日韩视频| 亚洲高清123| 狠狠色噜噜狠狠狠狠色吗综合| 国产精品v片在线观看不卡| 蜜臀av性久久久久蜜臀aⅴ| 欧美在线观看天堂一区二区三区| 中文无字幕一区二区三区| 亚洲美女精品久久| 亚洲第一天堂av| 欧美va亚洲va日韩∨a综合色| 久久九九国产精品| 久久精品国产2020观看福利| 欧美亚洲综合久久| 亚洲欧美中文另类| 亚洲一区二区三区高清不卡| 一区二区三区免费看| 99精品热6080yy久久| 亚洲免费久久| aⅴ色国产欧美| 亚洲系列中文字幕| 亚洲一区二区在线免费观看| 亚洲视频高清| 亚洲欧美在线高清| 午夜日韩在线| 久久国产精彩视频| 久久久久国产一区二区三区四区| 久久国产一二区| 久久久久看片| 欧美电影免费观看高清| 欧美激情第六页| 亚洲精品少妇网址| 亚洲视频在线观看| 欧美一区二区三区精品| 销魂美女一区二区三区视频在线| 欧美一区二区三区男人的天堂| 久久aⅴ国产紧身牛仔裤| 久久久久青草大香线综合精品| 久久青青草原一区二区| 欧美成人综合| 国产精品久久久久秋霞鲁丝| 国产日韩精品在线播放| 国产字幕视频一区二区| 亚洲国产99精品国自产| 一区二区三区视频免费在线观看| 亚洲亚洲精品在线观看| 欧美在线免费观看亚洲| 欧美v日韩v国产v| 亚洲精品黄色| 亚洲欧美精品伊人久久| 久久婷婷蜜乳一本欲蜜臀| 亚洲一区综合| 久久久综合精品| 亚洲国产一区二区精品专区| 亚洲性人人天天夜夜摸| 久久国产精品久久国产精品| 欧美日本三区| 黄色日韩精品| 亚洲主播在线播放| 麻豆亚洲精品| 亚洲深夜影院| 欧美激情视频在线免费观看 欧美视频免费一| 欧美日韩国产a| 黄色欧美成人| 午夜精品亚洲| 亚洲日本精品国产第一区| 亚洲午夜av电影| 女主播福利一区| 国产日韩欧美不卡在线| 一本色道久久| 免费高清在线一区| 亚洲一区二区三区中文字幕在线| 美女任你摸久久| 国产一区二区三区日韩欧美| 一区二区电影免费观看| 免费成人黄色| 欧美在线啊v| 国产精品日日摸夜夜摸av| 99v久久综合狠狠综合久久| 久久久久一区二区三区| 亚洲一区二区三| 欧美日韩精品三区| 亚洲精品久久久久久久久久久久|