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

ACM___________________________

______________白白の屋
posts - 182, comments - 102, trackbacks - 0, articles - 0
<2025年12月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

常用鏈接

留言簿(24)

隨筆分類(332)

隨筆檔案(182)

FRIENDS

搜索

積分與排名

最新隨筆

最新評論

閱讀排行榜

評論排行榜

HDOJ 2714 HDU 2714 ISBN ACM 2714 IN HDU

Posted on 2010-09-25 20:25 MiYu 閱讀(468) 評論(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>
            欧美伊人久久大香线蕉综合69| 亚洲图片欧美日产| 久久青草久久| 久久爱www久久做| 国产一区二区精品丝袜| 久久亚洲春色中文字幕| 久久精品视频在线| …久久精品99久久香蕉国产| 欧美激情精品久久久久久变态| 久久亚洲图片| 日韩视频在线免费观看| 日韩一级黄色av| 国产精品五月天| 久久裸体视频| 欧美激情网友自拍| 亚洲一区二区在| 欧美在线观看网站| 亚洲经典自拍| 一本色道久久综合狠狠躁篇怎么玩 | 国产精品久久久久久影视| 亚洲一区高清| 久久aⅴ国产欧美74aaa| 亚洲国产综合视频在线观看| 亚洲精品一区二区三区不| 国产精品乱人伦一区二区| 久久偷看各类wc女厕嘘嘘偷窃| 免费的成人av| 欧美日韩视频| 久久国内精品视频| 欧美激情亚洲自拍| 欧美中文字幕在线观看| 欧美顶级少妇做爰| 欧美一区二区视频在线| 能在线观看的日韩av| 亚洲欧美日韩一区在线观看| 久久久久久久波多野高潮日日 | 欧美国产乱视频| 午夜精品视频| 欧美不卡视频一区发布| 欧美在线观看一区| 欧美人交a欧美精品| 久久―日本道色综合久久| 欧美日韩喷水| 欧美成人午夜视频| 国产精品有限公司| 亚洲精品一区在线观看| 一区二区三区在线视频免费观看| 99综合精品| 亚洲精品看片| 久久视频免费观看| 久久久91精品国产| 国产精品欧美日韩久久| 亚洲精品久久久久| 影音先锋日韩资源| 性久久久久久久| 午夜精品视频在线观看| 欧美日韩国内| 亚洲精品免费一区二区三区| 亚洲风情亚aⅴ在线发布| 欧美一级视频| 久久狠狠亚洲综合| 国产欧美精品xxxx另类| 亚洲视频精品| 亚洲欧美日韩精品久久亚洲区 | 美国三级日本三级久久99| 久久久福利视频| 国产精品日韩欧美综合| 亚洲一二三四久久| 亚洲一本大道在线| 国产精品qvod| 亚洲特色特黄| 亚洲欧美日本日韩| 国产精品女同互慰在线看| 亚洲视频在线二区| 亚洲欧美卡通另类91av| 国产精品美女一区二区| 亚洲一区二区三| 狠狠爱成人网| 久久一区二区三区四区五区| 老牛影视一区二区三区| 1769国产精品| 欧美福利网址| 99www免费人成精品| 西西裸体人体做爰大胆久久久| 国产精品毛片在线看| 先锋影音久久久| 美女黄毛**国产精品啪啪 | 欧美另类高清视频在线| aa日韩免费精品视频一| 性欧美xxxx大乳国产app| 国产精品亚洲综合久久| 欧美中在线观看| 欧美激情精品久久久久久久变态 | 欧美日韩另类综合| 亚洲少妇在线| 久久婷婷av| 亚洲毛片在线| 国产精品视频免费一区| 久久久综合免费视频| 亚洲精品视频一区| 久久国产99| 亚洲免费观看视频| 国产欧美日韩伦理| 麻豆精品视频| 亚洲亚洲精品三区日韩精品在线视频 | 欧美日韩小视频| 欧美一区二区三区四区在线| 欧美国产精品中文字幕| 午夜电影亚洲| 亚洲国产欧美一区二区三区久久| 欧美小视频在线观看| 久久天天躁狠狠躁夜夜av| 一区二区久久久久| 欧美国产另类| 欧美专区福利在线| 一本一本久久a久久精品牛牛影视| 国产精品视频男人的天堂| 嫩草影视亚洲| 久久精品视频在线看| 在线亚洲免费视频| 亚洲大片在线| 久久天堂精品| 亚洲欧美综合网| 一区二区三区 在线观看视频| 韩国av一区二区三区在线观看| 国产精品www色诱视频| 欧美不卡视频一区| 久久精品夜色噜噜亚洲a∨| 99香蕉国产精品偷在线观看| 欧美韩日高清| 久久婷婷国产综合国色天香| 欧美一级在线视频| 在线视频一区二区| 99国产精品久久久久久久成人热 | 欧美久久99| 老司机aⅴ在线精品导航| 欧美专区日韩视频| 亚洲女人天堂av| 亚洲午夜高清视频| 亚洲影院色无极综合| 欧美日韩亚洲另类| 久久精品国产精品| 久久精品国产欧美激情| 一区二区av| 99天天综合性| 日韩视频在线免费观看| 亚洲国产精品一区| 亚洲第一页在线| 亚洲动漫精品| 亚洲电影第1页| 激情欧美日韩| 亚洲狠狠丁香婷婷综合久久久| 狠狠网亚洲精品| 尤物在线观看一区| 亚洲国产精品久久久久秋霞蜜臀 | 在线一区亚洲| 亚洲无亚洲人成网站77777| 99视频精品全部免费在线| 夜夜夜久久久| 亚洲在线电影| 久久精品国产一区二区三| 久久久久久婷| 欧美激情精品久久久久久蜜臀 | 性色一区二区三区| 性伦欧美刺激片在线观看| 性欧美暴力猛交另类hd| 久久久噜噜噜久久久| 老司机精品视频网站| 欧美精品一线| 国产精品日韩精品欧美精品| 国产亚洲欧美日韩美女| 在线观看视频免费一区二区三区| 亚洲人成亚洲人成在线观看| 一本久道久久久| 欧美在线观看视频一区二区| 狼狼综合久久久久综合网| 亚洲第一主播视频| 在线性视频日韩欧美| 久久精品国产综合精品| 欧美精品久久99| 国产日韩欧美三级| 亚洲精品一二三| 欧美一区二区三区视频免费播放| 久久综合999| 日韩亚洲精品电影| 欧美在线视频观看| 欧美日韩福利在线观看| 国产日韩一区二区三区在线播放 | 欧美三级午夜理伦三级中视频| 国产日本亚洲高清| 亚洲老司机av| 久久av一区二区三区亚洲| 亚洲国产精品日韩| 亚洲男人av电影| 欧美久久影院| 国内视频精品| 亚洲免费在线看| 91久久综合| 欧美在线观看网站| 亚洲精品乱码|