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

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://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  回復  更多評論   

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>
            国产精品v一区二区三区| 亚洲人屁股眼子交8| 亚洲淫片在线视频| 日韩午夜激情av| 久久字幕精品一区| 欧美激情在线观看| 亚洲一区二区成人| 久久久精品一品道一区| 国产精品爽爽ⅴa在线观看| 亚洲丶国产丶欧美一区二区三区| 国产精品推荐精品| 欧美大胆a视频| 久久天天躁狠狠躁夜夜爽蜜月| 欧美成人国产va精品日本一级| 欧美日韩国产天堂| 99精品国产福利在线观看免费 | 蜜桃视频一区| 国产精品美女久久久久久免费| 亚洲第一主播视频| 久久精品二区亚洲w码| 亚洲一区二区三区精品动漫| 国产精品免费久久久久久| 国产欧美日韩视频一区二区三区| 亚洲丝袜av一区| 亚洲国产99精品国自产| 老司机午夜精品| 一本色道久久| 日韩一区二区精品在线观看| 欧美va亚洲va香蕉在线| 欧美不卡视频一区发布| 亚洲女与黑人做爰| 激情欧美日韩一区| 亚洲性xxxx| 性久久久久久久| 久久夜色精品国产欧美乱极品 | 国产色综合久久| 日韩视频中文| 亚洲黄色在线观看| 久久疯狂做爰流白浆xx| 国产精品日韩一区| 亚洲素人在线| 欧美a级片网| 国产欧美日韩另类视频免费观看| 亚洲国产视频a| 亚洲视频1区| 国产精品久久久久久久久免费桃花| 亚洲欧美在线免费观看| 欧美日产国产成人免费图片| 亚洲黄色大片| 国产日韩三区| 久久久夜夜夜| 欧美精品日韩一本| 亚洲剧情一区二区| 亚洲第一区在线观看| 欧美一区二区日韩一区二区| 久久久久久网| 国产精品一区二区三区观看| 性做久久久久久久免费看| 另类av一区二区| 这里只有精品视频| 在线不卡中文字幕| 欧美伊人影院| 国产精品夜夜夜| 久久色在线播放| 亚洲免费在线视频一区 二区| 亚洲国产黄色| 永久免费毛片在线播放不卡| 欧美日韩系列| 午夜在线成人av| 欧美中文字幕精品| 久久综合国产精品| 亚洲成色www8888| 99热在线精品观看| 久久精品国产一区二区三| 激情六月婷婷久久| 亚洲电影第三页| 国产精品私房写真福利视频| 国产综合亚洲精品一区二| 亚洲第一偷拍| 午夜精品久久久久久久| 国产精品久久久久一区二区三区| 亚洲视频在线看| 另类国产ts人妖高潮视频| 国产精品久久久久av免费| 欧美亚洲综合网| 欧美亚洲一区三区| 欧美一区二区福利在线| 久久久国产精品一区二区三区| 国产精品亚洲精品| 国产精品xnxxcom| 激情校园亚洲| 亚洲资源在线观看| 亚洲一区三区视频在线观看| 久久精品99久久香蕉国产色戒| 欧美三区美女| 六月天综合网| 久久久久高清| 日韩手机在线导航| 久久国产乱子精品免费女 | 欧美日韩精品在线视频| 欧美三级欧美一级| 亚洲毛片在线看| 午夜免费久久久久| 亚洲精品韩国| 欧美电影免费网站| 红桃视频国产一区| 亚洲免费网址| 最新国产乱人伦偷精品免费网站| 久久久久久久一区二区| 久久青草欧美一区二区三区| 亚洲第一色在线| 欧美色欧美亚洲另类七区| 一本色道久久综合精品竹菊| 亚洲精品网址在线观看| 亚洲国产精品va在线观看黑人| 国产精品毛片大码女人| 久久天天躁夜夜躁狠狠躁2022| 国产精品分类| 一本一本久久a久久精品牛牛影视| 久久久久国产成人精品亚洲午夜| 久久久www成人免费无遮挡大片| 99精品免费| 最近看过的日韩成人| 亚洲国产91色在线| 亚洲靠逼com| 欧美午夜精品伦理| 亚洲综合视频一区| 亚洲免费成人| 性欧美1819sex性高清| 在线一区视频| 免费看的黄色欧美网站| 欧美日韩一区二区在线播放| 久久嫩草精品久久久久| 欧美一区二区三区视频在线观看 | 亚洲经典在线看| 久久久久久91香蕉国产| 欧美激情一区二区三区不卡| 99国产一区| 国产偷久久久精品专区| 亚洲欧美日韩成人高清在线一区| 久久久久久久欧美精品| 久久久精品午夜少妇| 欧美国产一区二区| 国产精品国产三级国产专播精品人| 欧美性一区二区| 尤物yw午夜国产精品视频明星 | 国产欧美日韩在线 | 浪潮色综合久久天堂| 欧美激情一区二区三区成人| 国产精品一区视频网站| 久久久福利视频| 国产日韩专区在线| 久久综合电影| 一区二区三区久久网| 麻豆av一区二区三区久久| 一区视频在线看| 欧美成人免费在线| 欧美理论在线播放| 欧美第一黄网免费网站| 欧美视频一区二| 亚洲日本成人| 久久久国产成人精品| 亚洲第一黄网| 亚洲精品国产拍免费91在线| 欧美日韩免费观看一区三区| 久久综合狠狠综合久久激情| 久久精品国产精品| 欧美一区二区精品在线| 欧美黄色成人网| 亚洲国产另类 国产精品国产免费| a4yy欧美一区二区三区| 欧美一区二区在线| 欧美日韩一区在线视频| 亚洲少妇诱惑| 欧美精品免费播放| 亚洲国产成人在线视频| 国产一区二区三区视频在线观看| 欧美电影免费观看大全| 亚洲第一天堂av| 午夜精品久久久久久99热软件| 亚洲韩国一区二区三区| 欧美亚洲一区二区在线| 国产自产v一区二区三区c| 午夜精品短视频| 蜜臀av国产精品久久久久| 欧美视频1区| 91久久精品日日躁夜夜躁国产| 久久中文字幕一区| 亚洲欧美另类综合偷拍| 国产精品免费网站| 欧美韩日精品| 欧美一区二区高清在线观看| 久久麻豆一区二区| 亚洲一区免费看| 久久午夜激情| 欧美一区二区三区久久精品茉莉花 | 亚洲欧美国产一区二区三区| 久久精品道一区二区三区| 欧美在线观看视频一区二区三区 | 欧美国产在线视频|