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

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>
            欧美一区二区三区在线视频 | 久久久噜噜噜久久人人看| 欧美特黄视频| 亚洲四色影视在线观看| 一本色道久久综合亚洲91| 欧美日韩综合不卡| 亚洲在线播放电影| 亚洲欧美色一区| a4yy欧美一区二区三区| 欧美日韩一区二区国产| 亚洲综合不卡| 午夜视频在线观看一区二区三区| 国产视频在线观看一区| 久久久噜噜噜久久中文字免| 久久久久www| 亚洲精品久久嫩草网站秘色 | 老色鬼精品视频在线观看播放| 欧美高清在线一区二区| 欧美大色视频| 国产资源精品在线观看| 久久天天综合| 欧美日韩国产一区二区三区地区 | 激情成人av| 亚洲高清三级视频| 欧美午夜免费影院| 久久亚洲高清| 欧美体内谢she精2性欧美| 性一交一乱一区二区洋洋av| 久久久国产成人精品| 在线综合+亚洲+欧美中文字幕| 亚洲男人的天堂在线观看| 激情综合电影网| 夜夜嗨av一区二区三区中文字幕| 国产精品一区免费在线观看| 亚洲第一毛片| 国产精品婷婷午夜在线观看| 欧美a级一区二区| 国产精品亚发布| 亚洲人在线视频| 雨宫琴音一区二区在线| 在线一区二区日韩| 亚洲美女精品久久| 亚洲大片av| 国产欧美综合一区二区三区| 亚洲精品免费网站| 在线观看国产精品淫| 一区二区三区精品国产| 亚洲日本va在线观看| 欧美专区在线观看| 亚洲欧美视频在线观看视频| 欧美福利视频在线观看| 久久综合狠狠综合久久综青草| 欧美亚日韩国产aⅴ精品中极品| 欧美mv日韩mv国产网站| 国产深夜精品| 亚洲欧美中文日韩在线| 亚洲一区二区在线免费观看| 欧美韩国日本一区| 亚洲福利视频一区二区| 在线不卡欧美| 久久精品女人的天堂av| 久久成人人人人精品欧| 国产精品久久久久aaaa九色| 99国产精品视频免费观看一公开 | 国产欧美视频一区二区| 在线亚洲精品福利网址导航| 一区二区三区四区精品| 欧美极品一区| 亚洲精品乱码久久久久久| 亚洲精品一区二区三区四区高清| 美日韩免费视频| 亚洲精品一区久久久久久| 久久综合给合久久狠狠色| 久久中文精品| 在线观看日韩www视频免费 | 一区二区三区视频免费在线观看| 亚洲精品欧美激情| 欧美国产激情| 亚洲精品一线二线三线无人区| 亚洲另类春色国产| 欧美日韩国产丝袜另类| 亚洲精品一区二区三区不| 一本到12不卡视频在线dvd| 欧美人与性动交a欧美精品| 亚洲精选一区| 亚洲欧美欧美一区二区三区| 国产精品麻豆成人av电影艾秋| 亚洲永久精品大片| 久久精品五月婷婷| 亚洲二区三区四区| 欧美激情第三页| 一本色道久久综合一区| 西瓜成人精品人成网站| 激情欧美一区二区| 欧美麻豆久久久久久中文| 亚洲午夜电影网| 老色鬼精品视频在线观看播放| 亚洲人成人99网站| 国产精品亚洲综合一区在线观看| 久久频这里精品99香蕉| 亚洲乱码国产乱码精品精98午夜| 午夜影院日韩| 亚洲三级国产| 国产女人18毛片水18精品| 另类酷文…触手系列精品集v1小说| 最近中文字幕日韩精品| 久久精品在线免费观看| 亚洲乱码国产乱码精品精可以看 | 午夜精品久久久久| 欧美成人综合| 亚洲女性喷水在线观看一区| 尹人成人综合网| 国产精品高潮粉嫩av| 久久久精品网| 亚洲永久精品国产| 亚洲日本中文字幕| 久久精视频免费在线久久完整在线看| 亚洲精品系列| 激情欧美一区| 国产麻豆综合| 欧美日韩成人综合| 久久综合五月天婷婷伊人| 亚洲一区二区毛片| 日韩一级成人av| 欧美激情视频给我| 老司机67194精品线观看| 亚洲欧美视频在线观看| 一区二区欧美在线| 亚洲黑丝在线| 极品少妇一区二区三区| 国产精品久久7| 欧美日韩美女在线| 欧美~级网站不卡| 久久人人看视频| 欧美专区一区二区三区| 羞羞视频在线观看欧美| 亚洲香蕉在线观看| 99香蕉国产精品偷在线观看| 亚洲福利国产| 亚洲电影欧美电影有声小说| 免费不卡中文字幕视频| 美女久久网站| 免费久久久一本精品久久区| 久久久久久久欧美精品| 久久九九精品99国产精品| 午夜精品久久久久久久久| 亚洲永久免费av| 亚洲一线二线三线久久久| 一区二区三区色| 亚洲图片欧洲图片日韩av| 一本久久精品一区二区| 一本一本久久a久久精品综合妖精| 亚洲乱码国产乱码精品精98午夜| 亚洲另类自拍| 亚洲淫片在线视频| 午夜视频精品| 久久精品青青大伊人av| 久久久久国产精品麻豆ai换脸| 久久久久网址| 欧美sm视频| 亚洲茄子视频| 一本色道**综合亚洲精品蜜桃冫| 一区二区三区精品国产| 午夜久久久久| 久久午夜电影网| 欧美日韩另类综合| 国产日韩欧美一区二区三区在线观看| 国产亚洲欧美激情| 亚洲国产欧洲综合997久久| 日韩视频在线一区| 欧美中文字幕不卡| 欧美国产亚洲另类动漫| 亚洲精选在线观看| 午夜精品久久久久久久蜜桃app| 欧美中文字幕第一页| 欧美11—12娇小xxxx| 国产精品免费电影| 亚洲国产另类久久久精品极度| 99在线|亚洲一区二区| 午夜精品亚洲一区二区三区嫩草| 久久亚洲二区| 99精品视频免费| 欧美综合77777色婷婷| 欧美激情偷拍| 加勒比av一区二区| 亚洲一区二区综合| 免费黄网站欧美| 中日韩美女免费视频网站在线观看| 久久精品国产精品亚洲综合| 欧美精品不卡| 一区二区三区在线视频播放 | 国产亚洲一区二区三区| 亚洲国产精品一区二区第一页| 亚洲午夜电影网| 欧美va天堂在线| 亚洲欧洲99久久| 欧美另类videos死尸| 国内精品亚洲| 午夜精品久久久久久久男人的天堂| 欧美激情a∨在线视频播放|