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

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://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>
            性欧美激情精品| 狂野欧美性猛交xxxx巴西| 一本久久精品一区二区| 亚洲天堂免费观看| 亚洲欧美bt| 久久嫩草精品久久久精品| 欧美激情视频一区二区三区免费| 欧美人体xx| 韩国一区二区三区美女美女秀| 亚洲国产精品欧美一二99| 一区二区久久久久久| 欧美一区二区三区精品电影| 欧美国产91| 在线综合亚洲欧美在线视频| 久久综合九色综合久99| 亚洲精品国产精品乱码不99| 羞羞色国产精品| 久久久久久电影| 国产精品视频一二三| 亚洲伦理精品| 麻豆精品视频在线| 中文在线资源观看网站视频免费不卡| 国产精品一区二区久久| 一区二区精品在线观看| 午夜精品国产更新| 国产精品理论片| 亚洲图片欧洲图片日韩av| 欧美成人免费播放| 国产精品vvv| 日韩一区二区久久| 亚洲国产欧美一区二区三区久久 | 亚洲在线视频| 欧美日韩成人一区二区| 亚洲激情综合| 欧美国产日韩a欧美在线观看| 亚洲一区影音先锋| 亚洲成人在线视频播放| 蜜桃av综合| 久久久噜噜噜久久中文字免| 亚洲天堂av在线免费| 久久在线视频| 欧美在线资源| 久久精品国内一区二区三区| 国产综合色精品一区二区三区| 欧美一级淫片aaaaaaa视频| 猫咪成人在线观看| 亚洲激情视频在线播放| 欧美一二区视频| 国模精品一区二区三区| 中文在线一区| 在线亚洲美日韩| 欧美国产成人精品| 一区二区三区日韩在线观看| 久久这里只有| 久久久精品欧美丰满| 久久黄金**| 91久久夜色精品国产九色| 亚洲激情电影中文字幕| 欧美日韩在线播放一区二区| 先锋影音国产一区| 欧美午夜女人视频在线| 91久久精品一区| 亚洲精品国产精品国产自| 久久色在线播放| 久久亚洲精品欧美| 欧美激情久久久久久| 美女精品国产| 亚洲国产精品ⅴa在线观看| 久久久久一区二区三区| 蜜桃av噜噜一区| 亚洲国产一区二区视频| 美女啪啪无遮挡免费久久网站| 久久欧美中文字幕| 欧美日韩日韩| 一区二区久久| 亚洲综合色网站| 久久午夜电影网| 欧美激情视频一区二区三区在线播放 | 亚洲视频精选在线| 亚洲午夜在线观看视频在线| 欧美一区二区三区视频免费播放| 亚洲欧美自拍偷拍| 久久亚洲高清| 亚洲高清在线视频| 国产精品亚洲片夜色在线| 亚洲欧美激情精品一区二区| 久久精品国产亚洲一区二区三区| 欧美日本精品在线| 中文国产一区| 久久精品一本久久99精品| 黄色免费成人| 欧美成人中文字幕| 噜噜爱69成人精品| 亚洲日韩视频| 国产精品xxx在线观看www| 午夜在线精品偷拍| 亚洲性感激情| 国产自产高清不卡| 欧美成人福利视频| 亚洲影视在线| 亚洲成人在线视频网站| 在线看欧美日韩| 欧美理论电影网| 午夜日韩av| 亚洲国产专区校园欧美| 午夜精品久久久久久久99热浪潮| 极品日韩久久| 久久久精品久久久久| 亚洲精品美女久久久久| 亚洲人成在线播放网站岛国| 国产精品99免费看 | 美日韩精品免费| 一区二区三区视频在线 | 久久激五月天综合精品| 亚洲三级影院| 美女精品网站| 午夜精品在线| 一区二区三区产品免费精品久久75| 国产精品永久免费在线| 欧美激情亚洲精品| 久久久精品网| 欧美一区二区视频97| 最新国产成人av网站网址麻豆| 久久精品国产精品| 亚洲制服少妇| 国产精品99久久久久久久女警| 又紧又大又爽精品一区二区| 裸体丰满少妇做受久久99精品| 亚洲欧美国产高清va在线播| 亚洲日本va在线观看| 欧美国产精品专区| 毛片基地黄久久久久久天堂| 午夜精品久久久久久| 中文在线不卡| 中文日韩在线| 一区二区三区久久久| 亚洲剧情一区二区| 亚洲欧洲一区二区三区| 亚洲第一视频| 在线播放不卡| 在线看欧美视频| 激情欧美日韩一区| 韩国v欧美v日本v亚洲v| 韩国亚洲精品| 在线观看亚洲一区| 一区二区三区我不卡| 欲香欲色天天天综合和网| 韩国成人精品a∨在线观看| 国产中文一区二区| 韩国在线视频一区| 韩曰欧美视频免费观看| 伊人成人在线| 91久久线看在观草草青青| 亚洲国产91| 日韩视频一区| 亚洲男人第一网站| 亚洲国产欧美国产综合一区| 在线观看91精品国产麻豆| 亚洲高清精品中出| 91久久国产自产拍夜夜嗨| 亚洲美女区一区| 一区二区三区黄色| 午夜精品av| 久久影视精品| 亚洲日本电影| 亚洲午夜精品在线| 欧美在线视频不卡| 亚洲视频在线免费观看| 亚洲欧美综合网| 两个人的视频www国产精品| 欧美成人午夜剧场免费观看| 欧美日韩99| 国产日韩欧美日韩大片| 欧美日韩在线视频一区二区| 久久久久综合网| 欧美久久久久中文字幕| 国产精品一区二区三区免费观看| 国产一区二区电影在线观看| 国产精品久久久| 欧美日在线观看| 韩国精品一区二区三区| 亚洲毛片在线看| 久久久久久久网| 亚洲美女精品久久| 久久成人一区| 亚洲狠狠婷婷| 欧美一区二区三区在线观看| 美脚丝袜一区二区三区在线观看 | 国产视频一区二区在线观看 | 性感少妇一区| 亚洲国产精品久久久久| 午夜精品久久久久久| 欧美成人免费大片| 国产午夜精品一区理论片飘花 | 欧美成人激情在线| 久久深夜福利免费观看| 日韩一区二区福利| 久久免费国产精品1| 国产精品久久久一区二区| 亚洲精品影视在线观看|