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

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>
            欧美一二区视频| 久久尤物视频| 日韩西西人体444www| 欧美久久在线| 在线综合亚洲| 亚洲一区免费| 尤物精品国产第一福利三区| 另类成人小视频在线| 欧美成人a∨高清免费观看| 一区二区三区|亚洲午夜| 99ri日韩精品视频| 国产伦精品一区| 欧美va天堂| 欧美日韩在线免费| 欧美一级黄色录像| 久久精品一本| 99国产精品久久久| 亚洲欧美在线一区| 亚洲黄色精品| 亚洲一区二区精品在线| 在线精品福利| 亚洲亚洲精品在线观看| 亚洲电影免费观看高清完整版在线观看 | 欧美国产免费| 国产精品美女久久久久久久| 麻豆精品一区二区综合av| 欧美激情欧美狂野欧美精品| 午夜一区在线| 欧美激情影音先锋| 欧美va天堂| 欧美怡红院视频一区二区三区| 久久久一二三| 午夜欧美电影在线观看| 免费看亚洲片| 久久综合伊人| 国产美女搞久久| 亚洲精选国产| 亚洲高清影视| 欧美一区二区三区视频在线| 一区二区三区精品视频在线观看| 久久久久亚洲综合| 久久本道综合色狠狠五月| 欧美精品入口| 亚洲国产精品一区制服丝袜| 国产精品日韩欧美| 999在线观看精品免费不卡网站| 亚洲第一主播视频| 久久精品国产一区二区三| 香蕉成人久久| 国产精品久久久久久久电影| 亚洲欧洲日韩女同| 亚洲人成艺术| 欧美r片在线| 欧美国产欧美综合| 在线色欧美三级视频| 欧美在线视屏 | 国产午夜精品久久久久久免费视| 99精品国产一区二区青青牛奶| 亚洲欧洲精品一区二区精品久久久| 亚欧美中日韩视频| 欧美一区二区三区在| 国产精品二区二区三区| 亚洲精品1区| 日韩视频免费| 欧美日韩国产一区| 亚洲精品欧美一区二区三区| 亚洲女同精品视频| 亚洲视频精选在线| 欧美日韩国产综合久久| 亚洲精品欧美极品| 亚洲欧美日韩在线不卡| 国产精品高潮呻吟久久av无限| 99天天综合性| 亚洲女人天堂av| 国产女精品视频网站免费 | 免费成人你懂的| 亚洲福利视频在线| 欧美1级日本1级| 亚洲精品社区| 午夜久久久久久| 国精产品99永久一区一区| 久久先锋影音av| 亚洲人成网站影音先锋播放| 中文精品一区二区三区| 国产嫩草一区二区三区在线观看| 亚洲欧美在线另类| 欧美岛国激情| 一区二区三区四区国产| 国产精品老牛| 久久久精品日韩| 亚洲欧洲一区二区三区| 亚洲欧美韩国| 一区免费观看| 欧美日韩第一区日日骚| 亚洲午夜在线观看| 免费短视频成人日韩| 在线一区二区三区四区五区| 国产婷婷精品| 欧美精品久久一区| 午夜精品网站| 亚洲片国产一区一级在线观看| 午夜精品视频在线观看| 亚洲国产天堂久久国产91| 国产精品xvideos88| 久久久久久久网站| 亚洲一级特黄| 亚洲第一精品福利| 欧美一区二粉嫩精品国产一线天| 亚洲国产导航| 国产日韩欧美综合在线| 欧美激情成人在线视频| 欧美一级视频| 中文在线资源观看视频网站免费不卡| 久久影视精品| 欧美一区二区大片| 99一区二区| 亚洲日本欧美天堂| 黄色一区二区在线观看| 国产精品一页| 国产精品久久久| 欧美精品色网| 欧美成人精品| 蜜桃av一区| 久久噜噜噜精品国产亚洲综合| 亚洲淫性视频| 亚洲视频第一页| 亚洲乱码久久| 亚洲国产天堂久久综合| 老**午夜毛片一区二区三区| 欧美一区二区三区视频免费| 亚洲一区二区三区免费观看 | 久久夜色精品国产| 久久福利资源站| 午夜亚洲性色视频| 亚洲欧美日韩综合国产aⅴ | 久久精品欧美| 午夜精品剧场| 欧美在现视频| 久久av红桃一区二区小说| 欧美亚洲视频在线观看| 亚洲欧美日韩一区在线观看| 亚洲一区二区三区在线看| 在线综合亚洲| 亚洲欧美国产日韩天堂区| 亚洲小少妇裸体bbw| 一区二区三区视频在线 | 国产一区二区电影在线观看| 国产精品少妇自拍| 国产日韩一区二区三区在线| 国产视频观看一区| 伊人激情综合| 亚洲国产综合在线| 999在线观看精品免费不卡网站| 亚洲免费不卡| 亚洲自拍偷拍麻豆| 久久精品国产精品 | 久久婷婷综合激情| 美女图片一区二区| 亚洲高清资源综合久久精品| 亚洲精品综合| 亚洲一区二区三区四区视频| 亚洲欧美日韩精品久久久| 久久精品主播| 欧美国产一区二区| 欧美特黄一级大片| 国内外成人在线| 亚洲国产成人在线| 亚洲免费视频观看| 久久久久久一区| 亚洲激情中文1区| 亚洲一区精品电影| 久久婷婷人人澡人人喊人人爽| 欧美精品系列| 国产私拍一区| 一区二区三区不卡视频在线观看| 午夜精品一区二区三区在线| 男女激情视频一区| 一本大道久久a久久精品综合| 亚洲一区二区在线免费观看| 久久久天天操| 国产精品一级久久久| 亚洲经典三级| 欧美一区二区在线观看| 亚洲国产一区二区a毛片| 亚洲影视中文字幕| 欧美护士18xxxxhd| 国精品一区二区三区| 亚洲视频自拍偷拍| 欧美黄色影院| 久久aⅴ乱码一区二区三区| 欧美经典一区二区三区| 韩国一区二区三区在线观看| 亚洲午夜在线| 亚洲激情在线观看视频免费| 久久av一区二区三区漫画| 国产精品成人观看视频免费| 亚洲激情网站免费观看| 久久er精品视频| 国产在线观看91精品一区| 亚洲一区二区三区四区中文|