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

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 閱讀(467) 評論(1)  編輯 收藏 引用 所屬分類: ACM ( 水題 )

MiYu原創(chuàng), 轉(zhuǎn)帖請注明 : 轉(zhuǎn)載自 ______________白白の屋    

題目地址 :

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.

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

 

代碼如下 :

 /*

Coded By  : MiYu

Link      : http://www.cnblogs.com/MiYu  || http://www.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  回復(fù)  更多評論   

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>
            亚洲直播在线一区| 亚洲欧美日韩中文在线制服| 欧美成人小视频| 欧美 日韩 国产 一区| 亚洲国产高清一区| 亚洲激情国产| 欧美美女日韩| 国产精品国产成人国产三级| 欧美精品三级日韩久久| 亚洲电影在线免费观看| 亚洲国产高清在线观看视频| 欧美精品一区二| 一区二区三区产品免费精品久久75 | 国产一区清纯| 理论片一区二区在线| 免费不卡中文字幕视频| 亚洲色图制服丝袜| 性做久久久久久| 亚洲国产欧美在线人成| 99国产精品久久久久久久久久| 国产精品丝袜xxxxxxx| 久久九九久精品国产免费直播| 麻豆精品精华液| 亚洲欧美另类久久久精品2019| 久久爱91午夜羞羞| 99re这里只有精品6| 亚洲欧美日韩综合aⅴ视频| 亚洲第一主播视频| 一区二区三区久久精品| 在线不卡视频| 亚洲尤物视频在线| 亚洲精品综合| 久久成年人视频| 亚洲综合好骚| 欧美久久综合| 久久综合一区| 国产美女扒开尿口久久久| 欧美二区在线看| 国产无一区二区| 一二三区精品福利视频| 亚洲国产精品久久久久| 欧美一区二区视频在线| 中日韩美女免费视频网址在线观看 | 一区二区av| 亚洲精品裸体| 老鸭窝毛片一区二区三区 | 亚洲国内自拍| 久久xxxx精品视频| 午夜一区在线| 欧美性猛片xxxx免费看久爱| 亚洲高清在线视频| 亚洲激情电影在线| 久久国产精品亚洲77777| 亚洲欧美中文字幕| 欧美三区在线视频| 亚洲精品影视| 9色精品在线| 欧美久久久久久久| 亚洲国产裸拍裸体视频在线观看乱了中文| 国产一区二区三区精品欧美日韩一区二区三区 | 国产精品美女黄网| 亚洲精品中文字幕女同| 亚洲精品一级| 欧美国产日本| 日韩亚洲精品电影| 亚洲午夜羞羞片| 国产精品ⅴa在线观看h| 一本色道精品久久一区二区三区| 中文有码久久| 国产精品www.| 亚洲欧美视频一区二区三区| 欧美一区二区三区视频免费| 国产精品亚洲不卡a| 亚洲永久网站| 久久青草福利网站| 亚洲国产成人不卡| 欧美激情第8页| 夜夜嗨网站十八久久| 午夜日韩激情| 一区在线观看| 欧美人与禽猛交乱配视频| 亚洲免费观看高清完整版在线观看熊 | 在线日韩日本国产亚洲| 老司机成人在线视频| 亚洲欧洲免费视频| 亚洲专区在线| 国产综合久久久久久| 美女精品网站| 亚洲视频免费| 免费在线播放第一区高清av| 日韩亚洲成人av在线| 欧美日韩在线播放三区| 亚洲欧美激情四射在线日 | 亚洲精品之草原avav久久| 亚洲视频免费在线| 国产日韩在线播放| 免费成人黄色| 亚洲视频一区二区在线观看 | 日韩亚洲欧美成人一区| 国产精品久久久久久久第一福利 | 一区二区三区|亚洲午夜| 欧美一区二区视频在线| 在线成人亚洲| 国产精品美女一区二区| 久久免费国产| 亚洲少妇最新在线视频| 欧美成人精品高清在线播放| 亚洲一区影音先锋| 亚洲黄色性网站| 国产精品美女久久久久久2018| 久久综合狠狠| 性欧美大战久久久久久久免费观看| 欧美成人午夜激情视频| 欧美中在线观看| 一本色道精品久久一区二区三区 | 欧美伦理91i| 久久视频这里只有精品| 亚洲一区在线播放| 亚洲区中文字幕| 欧美成人免费在线| 久久精品视频导航| 亚洲欧美精品在线| 99精品国产高清一区二区| 黄色一区二区三区| 国产裸体写真av一区二区| 欧美精品久久久久久久久老牛影院| 久久狠狠久久综合桃花| 亚洲视频一区| 一本色道久久综合精品竹菊| 欧美大胆人体视频| 另类图片国产| 久久久久久有精品国产| 亚洲欧美日韩国产中文在线| 日韩亚洲国产精品| 亚洲激情视频在线| 伊人成人在线| 1769国内精品视频在线播放| 国精产品99永久一区一区| 国产精品日韩一区| 国产精品―色哟哟| 国产精品色婷婷久久58| 欧美日韩在线免费| 欧美日韩午夜在线视频| 欧美日韩免费精品| 欧美视频免费在线观看| 欧美视频一区二区| 国产精品高清免费在线观看| 欧美日韩一区在线| 国产精品福利网| 国产精品久久久久久久久果冻传媒| 国产精品v一区二区三区 | 久久久久久久尹人综合网亚洲| 欧美一区二区播放| 久久精品视频免费播放| 久久天天综合| 欧美国产日韩视频| 欧美日韩视频一区二区| 国产精品久久9| 国产日韩亚洲| 亚洲成色777777女色窝| 亚洲精品影视| 午夜精品久久久久久久久| 欧美亚洲免费高清在线观看| 久久久久成人精品| 欧美大片第1页| 日韩视频免费观看高清在线视频| 一区二区精品| 久久久久久高潮国产精品视| 蜜桃av综合| 国产精品va在线| 黄色成人在线免费| 99re热这里只有精品视频 | 亚洲激情一区| 亚洲天堂激情| 看欧美日韩国产| 亚洲欧洲久久| 午夜精品久久久久久久久| 麻豆av一区二区三区| 国产精品国产三级国产普通话三级 | 亚洲一区二区三区久久| 久久久久国产免费免费| 亚洲国产婷婷综合在线精品 | 亚洲女人天堂av| 免费一区二区三区| 国产精品美女www爽爽爽| 在线观看日韩av电影| 亚洲自拍偷拍视频| 免费永久网站黄欧美| 亚洲一区二区高清| 免费观看欧美在线视频的网站| 国产精品麻豆成人av电影艾秋| 最新精品在线| 久久精品国产综合精品| 亚洲精品久久久蜜桃| 久久国产黑丝| 国产精品免费aⅴ片在线观看| 亚洲精品国产视频| 久久一区二区三区四区五区| 日韩午夜中文字幕| 美女国产精品|