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

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 閱讀(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>
            欧美www视频在线观看| 久久er99精品| 欧美性猛交xxxx乱大交蜜桃| 99在线|亚洲一区二区| 亚洲精品综合| 国产精品午夜在线观看| 久久精品亚洲精品国产欧美kt∨| 久久av一区| 亚洲区欧美区| 亚洲天堂成人| 精品福利电影| 99国产欧美久久久精品| 国产亚洲精品美女| 欧美www视频在线观看| 欧美日韩国产美女| 欧美在线播放| 欧美激情精品久久久六区热门 | 亚洲欧美日韩中文视频| 国产精品久久久久一区| 久久精品一区二区| 免费中文字幕日韩欧美| 性欧美超级视频| 男同欧美伦乱| 久久av资源网站| 欧美精品福利在线| 久久久久国产精品麻豆ai换脸| 免费成人激情视频| 欧美亚洲午夜视频在线观看| 另类春色校园亚洲| 欧美综合国产| 欧美日韩在线免费观看| 麻豆成人在线| 国产精品综合不卡av| 国产亚洲精品7777| 亚洲另类在线一区| 亚洲成色最大综合在线| 亚洲一区欧美| 99re成人精品视频| 老司机aⅴ在线精品导航| 午夜视频一区| 欧美日韩国产小视频在线观看| 久久亚洲一区| 国产欧美精品日韩| 一区二区电影免费观看| 亚洲国产99精品国自产| 香蕉亚洲视频| 欧美亚洲免费电影| 国产精品白丝av嫩草影院| 欧美激情久久久久| 亚洲福利视频免费观看| 欧美综合激情网| 久久精品国产精品亚洲| 国产精品腿扒开做爽爽爽挤奶网站 | 欧美国产精品久久| 另类av一区二区| 狠狠色香婷婷久久亚洲精品| 亚洲欧美在线x视频| 午夜欧美电影在线观看| 国产精品久久久久久妇女6080 | 国产精品久久久久久久久久尿 | 久久九九99| 国产乱码精品一区二区三| 在线天堂一区av电影| 一本色道久久综合亚洲精品高清| 1024亚洲| 欧美激情一区在线观看| 亚洲激情av在线| 亚洲黄色在线视频| 欧美风情在线观看| 亚洲精美视频| 亚洲午夜伦理| 国产精品久久久久一区二区三区共 | 久久精品天堂| 免费中文日韩| 日韩一级不卡| 国产精品久久久久aaaa| 亚洲欧美成人一区二区在线电影| 久久国产手机看片| 在线不卡中文字幕播放| 欧美高清在线视频| 一区二区三区欧美激情| 久久久91精品国产一区二区三区 | 欧美巨乳在线| 中文av一区特黄| 久久精品女人天堂| 亚洲黄色视屏| 欧美视频观看一区| 欧美一区二区三区视频| 亚洲国产精品va在线观看黑人| 99re热这里只有精品免费视频| 国产精品国产自产拍高清av| 欧美在线观看视频在线| 亚洲电影免费观看高清完整版| 一本大道久久a久久精品综合| 国产精品初高中精品久久| 久久久www| 日韩亚洲欧美一区| 久久久久久久久综合| 99精品国产福利在线观看免费| 国产精品电影观看| 久久综合一区| 亚洲欧美中文另类| 亚洲国产精品t66y| 久久久精品五月天| 亚洲一卡久久| 亚洲欧洲三级| 国产亚洲精品v| 欧美日韩国产美女| 日韩午夜视频在线观看| 国产女主播一区| 欧美国产极速在线| 久久精品国产一区二区三区 | 欧美在线观看一区二区三区| 在线亚洲国产精品网站| 快射av在线播放一区| 亚洲免费一区二区| 亚洲九九爱视频| 亚洲成色精品| 国产一区欧美| 国产精品一区二区久久国产| 欧美人交a欧美精品| 久久综合色播五月| 久久激情中文| 欧美在线亚洲| 小黄鸭精品aⅴ导航网站入口| 亚洲欧洲午夜| 亚洲电影免费观看高清| 免费不卡视频| 美日韩精品视频免费看| 久久精品在线播放| 欧美在线视频不卡| 午夜精品美女久久久久av福利| 99成人在线| 99视频超级精品| 亚洲精品久久久久中文字幕欢迎你| 国精品一区二区| 国产伊人精品| 精品成人在线观看| 在线精品观看| 亚洲黄色在线| 欧美一区二区三区在线观看视频 | 老司机午夜精品| 欧美中文字幕视频| 欧美中文字幕不卡| 久久精彩免费视频| 久久久久久噜噜噜久久久精品| 久久电影一区| 久久久精品国产免费观看同学| 欧美综合激情网| 久久人体大胆视频| 欧美va天堂va视频va在线| 欧美承认网站| 欧美日韩在线视频首页| 国产精品日产欧美久久久久| 国产精品毛片大码女人| 国产精品一区毛片| 狠狠色综合一区二区| 91久久久久久国产精品| 99精品国产高清一区二区| 亚洲女ⅴideoshd黑人| 久久国产主播| 亚洲高清自拍| 一区二区免费看| 欧美一乱一性一交一视频| 久久综合伊人77777蜜臀| 欧美成人综合| 国产欧美韩日| 亚洲精品乱码久久久久久| 在线视频一区二区| 久久精品噜噜噜成人av农村| 欧美韩日视频| 亚洲免费视频观看| 久热国产精品| 国产精品日韩欧美综合| 亚洲高清123| 亚洲一区欧美| 欧美www视频| 亚洲在线免费观看| 欧美成人亚洲| 国产视频久久久久| 9久草视频在线视频精品| 欧美中文在线免费| 亚洲国内自拍| 久久国产免费| 欧美亚一区二区| 亚洲韩国日本中文字幕| 午夜精品一区二区在线观看| 美女91精品| 亚洲一区免费观看| 欧美激情五月| 136国产福利精品导航| 亚洲欧美中文字幕| 亚洲电影视频在线| 久久爱www久久做| 国产精品高清网站| 亚洲美女黄色片| 免费在线观看一区二区| 欧美一二三视频| 国产精品久久二区二区| 99re6热在线精品视频播放速度 |