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

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 閱讀(467) 評論(1)  編輯 收藏 引用 所屬分類: ACM ( 水題 )

MiYu原創(chuàng), 轉(zhuǎn)帖請注明 : 轉(zhuǎn)載自 ______________白白の屋    

題目地址 :

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.

這句話是關(guān)鍵 , 意思就是 除了最后一個數(shù)字 可能是 X 外  其他的都只能為 0-9的數(shù)字.

 

代碼如下 :

 /*

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  回復(fù)  更多評論   

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>
            今天的高清视频免费播放成人 | 国产亚洲午夜| 亚洲电影天堂av| 国产婷婷精品| 亚洲视频一区二区| 999在线观看精品免费不卡网站| 欧美在线视频日韩| 亚洲欧美怡红院| 欧美日韩一区二区在线观看| 欧美国产精品久久| 激情久久五月| 久久久久成人网| 欧美一区在线视频| 国产精品日本一区二区 | 亚洲成色精品| 亚洲电影免费观看高清完整版| 亚洲免费视频中文字幕| 亚洲特黄一级片| 欧美日本高清| 亚洲精一区二区三区| 亚洲三级性片| 欧美成人一区二区在线| 欧美第一黄网免费网站| 亚洲大胆女人| 美女任你摸久久| 欧美大片在线观看| 亚洲欧洲精品一区二区三区波多野1战4| 亚洲欧美在线视频观看| 久久成人精品视频| 极品少妇一区二区三区| 久久精品国产清高在天天线| 久久久久网址| 在线观看视频一区| 模特精品在线| 亚洲精品在线三区| 亚洲欧美日韩另类精品一区二区三区| 欧美午夜精品理论片a级大开眼界| 亚洲三级免费电影| 中文av一区特黄| 国产精品午夜av在线| 亚洲综合另类| 麻豆九一精品爱看视频在线观看免费 | 欧美精品一区二区三区蜜臀| 91久久精品国产91久久性色| 一本色道婷婷久久欧美| 国产精品v欧美精品v日韩精品 | 久久人人爽人人爽| 欧美激情片在线观看| 一区二区三区久久久| 国产精品久久97| 久久精品国产综合| 久久精品一区二区三区四区| 亚洲影院污污.| 欧美激情亚洲一区| 在线一区免费观看| 你懂的网址国产 欧美| 久久精品国产亚洲一区二区| 国产精品扒开腿做爽爽爽软件| 亚洲国产精品悠悠久久琪琪| 国产综合久久久久久鬼色| 一区二区三区四区精品| 一本色道精品久久一区二区三区| 久久久人人人| 老色鬼久久亚洲一区二区| 国产在线观看91精品一区| 亚洲综合三区| 欧美制服丝袜| 国产欧美一区视频| 翔田千里一区二区| 欧美在线欧美在线| 国产亚洲欧美另类中文| 欧美一区二区三区免费大片| 久久大综合网| 国产在线精品一区二区中文| 欧美中文字幕视频在线观看| 久久久久在线观看| 在线观看欧美日韩| 免费观看在线综合色| 亚洲人成小说网站色在线| 99爱精品视频| 国产精品久久久久久久久免费樱桃 | 欧美日韩精品二区第二页| 亚洲美女黄色| 午夜精品亚洲一区二区三区嫩草| 国产精品国产a级| 亚洲资源av| 久久青草欧美一区二区三区| 在线播放亚洲| 欧美激情一区二区在线| 日韩视频久久| 久久超碰97中文字幕| 在线看日韩欧美| 欧美日韩视频一区二区三区| 亚洲性线免费观看视频成熟| 久久久国产精品一区二区中文 | 欧美视频免费看| 亚洲欧美激情视频| 美国十次成人| 亚洲一二三四区| 在线观看日韩av| 欧美午夜电影完整版| 欧美亚洲在线观看| 亚洲国产欧美一区二区三区久久 | av成人激情| 国产欧美在线视频| 牛牛国产精品| 午夜精品久久久久久久白皮肤 | 毛片一区二区| 亚洲视频第一页| 国内偷自视频区视频综合| 欧美精品v日韩精品v国产精品| 亚洲婷婷在线| 亚洲黄一区二区| 久久嫩草精品久久久久| av成人激情| 亚洲高清视频在线观看| 国产精品久久久久久久app| 久久深夜福利免费观看| 亚洲永久精品国产| 亚洲激情图片小说视频| 久久精品国产亚洲精品| 在线综合亚洲欧美在线视频| 亚洲第一黄色| 国产主播精品在线| 国产精品区一区| 欧美日韩亚洲在线| 欧美福利一区二区| 久久久久成人精品| 欧美在线不卡视频| 亚洲午夜久久久久久久久电影院 | 久久麻豆一区二区| 亚洲免费中文| 在线一区二区三区四区| 最新亚洲激情| 亚洲国产视频一区| 欧美va天堂| 久久午夜视频| 久久青草福利网站| 久久蜜臀精品av| 久久久久久欧美| 久久久久久91香蕉国产| 欧美一区二区视频在线| 午夜精品视频| 亚洲欧美日韩中文在线制服| 亚洲视频一区在线观看| 一区二区三区高清在线| 夜夜爽www精品| 一本色道久久加勒比88综合| 亚洲久色影视| 一本色道久久99精品综合| 9i看片成人免费高清| 一区二区三区免费网站| 亚洲视频免费| 亚洲欧美一区二区精品久久久| 香蕉av777xxx色综合一区| 午夜欧美不卡精品aaaaa| 欧美一区视频在线| 久久久久久网站| 欧美电影电视剧在线观看| 欧美激情网站在线观看| 亚洲精品美女在线| 一区二区精品国产| 亚洲欧美成aⅴ人在线观看| 欧美在线视频免费播放| 久久亚洲国产成人| 欧美激情精品久久久六区热门 | 蜜臀av国产精品久久久久| 嫩草伊人久久精品少妇av杨幂| 欧美极品在线观看| 国产精品sss| 国产在线播精品第三| 亚洲国产精品成人| 中文国产成人精品| 久久精品欧美日韩精品| 欧美成人蜜桃| 正在播放亚洲一区| 欧美一区二区三区四区高清| 蜜桃久久精品乱码一区二区| 欧美日韩在线看| 国产综合久久久久久鬼色| 亚洲精品一二三| 亚洲精品一品区二品区三品区| 亚洲视频第一页| 久久久久久久综合狠狠综合| 欧美精品综合| 狠狠色丁香婷综合久久| av不卡在线| 鲁大师成人一区二区三区 | 亚洲女女做受ⅹxx高潮| 另类综合日韩欧美亚洲| 夜夜狂射影院欧美极品| 性色av一区二区怡红| 欧美xx视频| 欧美诱惑福利视频| 欧美日韩一二三区| 在线观看日韩www视频免费| 欧美一级二区| 亚洲欧洲在线看| 亚洲欧美日韩直播| 欧美日韩一区三区|