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

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好男人在线观看| 欧美激情第3页| 一区二区欧美精品| 欧美日韩一区二区三区在线 | 亚洲国产欧美国产综合一区| 久久黄色小说| 久久精品国产69国产精品亚洲 | 欧美二区在线播放| 亚洲欧洲日产国产网站| 91久久久久久久久久久久久| 欧美久久久久久久| 午夜精品久久久久久久男人的天堂 | 亚洲精品男同| 一区二区黄色| 国产一级精品aaaaa看| 免费久久99精品国产| 欧美视频在线视频| 欧美伊久线香蕉线新在线| 欧美一区二区三区免费看 | 久久婷婷丁香| 亚洲毛片av| 亚洲欧美日韩精品久久亚洲区 | 亚洲国产激情| 亚洲天堂激情| 亚洲国产高清一区| 亚洲午夜一区二区| 亚洲激情影院| 欧美一区二区三区视频免费播放| 在线免费不卡视频| 亚洲一区日韩| 亚洲精品影视在线观看| 亚洲欧美色婷婷| 99国产精品国产精品久久| 欧美一区二区日韩| 日韩一级大片在线| 久久青草久久| 欧美一区二区三区四区在线 | 久久精品日韩| 亚洲欧美日韩在线播放| 欧美777四色影视在线| 欧美在线视频观看免费网站| 欧美精品一区二区精品网| 久久久www免费人成黑人精品 | 欧美日韩亚洲一区二区三区四区| 久久成人久久爱| 欧美午夜精彩| 91久久精品视频| 在线免费高清一区二区三区| 国产曰批免费观看久久久| 欧美福利电影在线观看| 国产一级揄自揄精品视频| 99综合电影在线视频| 亚洲乱码国产乱码精品精天堂| 欧美亚洲系列| 欧美在线视频全部完| 欧美香蕉视频| 99re在线精品| 亚洲社区在线观看| 欧美裸体一区二区三区| 亚洲国产精品尤物yw在线观看 | 欧美日韩国产在线| 亚洲国产精品久久久久婷婷884| 国内综合精品午夜久久资源| 午夜精品久久久久久99热软件| 亚洲一区精品视频| 国产精品magnet| 亚洲淫性视频| 欧美一区二区在线免费播放| 国产精品jizz在线观看美国 | 亚洲尤物在线| 欧美在线播放一区| 国产一区二区三区在线观看精品| 午夜精品av| 久久夜色精品国产亚洲aⅴ| 国内精品久久久久影院 日本资源| 欧美在线免费观看视频| 久久麻豆一区二区| 亚洲高清一区二| 欧美高清视频免费观看| 亚洲激情婷婷| 午夜精品在线看| 国产日韩在线播放| 久久久噜噜噜久久中文字免| 欧美国产日韩a欧美在线观看| 亚洲日本中文字幕| 国产精品s色| 欧美一区1区三区3区公司| 美女脱光内衣内裤视频久久影院| 亚洲经典一区| 欧美无砖砖区免费| 久久国产黑丝| 亚洲国产裸拍裸体视频在线观看乱了| 亚洲免费高清视频| 国产精品美女久久久久aⅴ国产馆| 欧美一区亚洲| 亚洲精品孕妇| 久久久久久久综合| 夜夜爽夜夜爽精品视频| 国产老肥熟一区二区三区| 久久精品视频播放| 91久久久久久| 久久亚洲精选| 在线一区二区三区四区| 国产综合色在线| 欧美日韩精品不卡| 久久精品视频在线播放| 日韩天天综合| 欧美成人在线免费观看| 亚洲欧美中日韩| 亚洲人屁股眼子交8| 亚洲欧美日韩国产综合| 在线日韩电影| 国产麻豆9l精品三级站| 欧美精品久久99久久在免费线| 亚洲欧美日韩一区| 亚洲精品色图| 欧美国产高清| 久久影视精品| 校园春色国产精品| 一本久久综合亚洲鲁鲁五月天| 韩国三级电影一区二区| 国产精品久久久久国产a级| 欧美福利电影在线观看| 久久久久国产免费免费| 亚洲欧美制服另类日韩| 亚洲伦理精品| 91久久精品国产| 欧美韩日一区二区| 老司机成人网| 久久久欧美一区二区| 欧美一区二区视频97| 亚洲影视综合| 亚洲一区二区三区免费观看| 亚洲精品资源| 亚洲精品美女免费| 亚洲日本成人网| 亚洲国产精品久久精品怡红院| 国产一区久久久| 国产亚洲精品成人av久久ww| 国产精品美女主播在线观看纯欲| 欧美日韩国产综合网| 欧美国产日本高清在线| 欧美成人一二三| 欧美激情第1页| 欧美日韩ab片| 欧美午夜宅男影院在线观看| 欧美日韩蜜桃| 国产精品第一页第二页第三页| 欧美日韩亚洲一区二区三区| 欧美日韩在线不卡| 欧美日韩一区二区欧美激情| 欧美午夜精品伦理| 国产精品视频一区二区三区| 国产精品一二一区| 国产一区二区三区在线观看网站 | 欧美日韩91| 国产精品成人v| 国产麻豆成人精品| 精品成人一区二区| 亚洲激情在线观看视频免费| 亚洲精品一区二区三区在线观看| 一本久久精品一区二区| 亚洲午夜视频在线| 欧美一区1区三区3区公司| 久久久夜精品| 亚洲国产99精品国自产| 一区二区三区欧美激情| 亚洲女同精品视频| 麻豆精品在线视频| 欧美日韩综合久久| 很黄很黄激情成人| 亚洲美女中文字幕| 午夜电影亚洲| 农村妇女精品| 在线亚洲免费视频| 久久免费视频在线| 国产精品高潮呻吟久久av黑人| 国产视频一区二区三区在线观看| 亚洲第一精品福利| 亚洲欧美日韩国产另类专区| 久久久爽爽爽美女图片| 91久久精品一区二区别| 亚洲在线播放| 91久久夜色精品国产网站| 亚洲欧美福利一区二区| 久久影院午夜论| 亚洲图片欧美一区| 久久综合伊人77777尤物| 国产精品久久777777毛茸茸| 亚洲成色777777在线观看影院| 中日韩午夜理伦电影免费| 久久一区中文字幕| 亚洲先锋成人| 欧美人在线观看| 怡红院av一区二区三区| 性高湖久久久久久久久| 亚洲经典一区| 久久午夜av| 国产婷婷色一区二区三区四区 | 激情一区二区|