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

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://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>
            日韩午夜黄色| 欧美伊久线香蕉线新在线| 久久资源在线| 久久免费高清| 亚洲理伦电影| 夜夜狂射影院欧美极品| 国产精品视频观看| 久久午夜电影| 欧美福利在线观看| 午夜天堂精品久久久久| 欧美亚洲三区| 亚洲黄色影院| 亚洲少妇诱惑| 韩国精品主播一区二区在线观看| 久久先锋资源| 欧美日韩一区二区在线视频 | 久久久91精品国产一区二区精品| 在线免费不卡视频| 一本大道久久a久久综合婷婷| 国产女主播在线一区二区| 久久综合国产精品台湾中文娱乐网| 你懂的成人av| 小嫩嫩精品导航| 免费成人黄色片| 性欧美大战久久久久久久免费观看| 久久久99久久精品女同性| 一区二区精品| 久久精品在线免费观看| 中文欧美字幕免费| 久久久亚洲成人| 午夜免费电影一区在线观看| 免费国产一区二区| 久久久九九九九| 国产精品国产三级国产aⅴ无密码| 久久婷婷久久| 国产乱码精品一区二区三区av| 欧美激情国产精品| 国产亚洲福利| 一区二区三区视频免费在线观看| 亚洲高清一二三区| 欧美一级大片在线免费观看| 亚洲视频免费在线| 欧美电影免费观看高清完整版| 欧美一区二区三区四区视频| 欧美日韩亚洲天堂| 亚洲国产精品一区二区久| 国产日韩欧美综合| 亚洲午夜高清视频| 亚洲视频一区二区免费在线观看| 麻豆成人av| 男人的天堂成人在线| 国产婷婷一区二区| 欧美在线免费视频| 欧美一级专区| 国产乱子伦一区二区三区国色天香 | 欧美日本亚洲视频| 亚洲激情图片小说视频| 亚洲盗摄视频| 老鸭窝91久久精品色噜噜导演| 久久久久久久久综合| 国产欧美一区二区三区在线看蜜臀 | 欧美在线短视频| 国产精品一级| 亚洲女同在线| 久久国产精品黑丝| 国产有码在线一区二区视频| 欧美一区二区在线| 久久婷婷国产麻豆91天堂| 韩国三级电影久久久久久| 久久国产加勒比精品无码| 久久另类ts人妖一区二区| 黄色一区三区| 久热精品在线视频| 亚洲激情不卡| 亚洲私人影院在线观看| 国产精品福利在线| 午夜国产精品影院在线观看| 久久美女性网| 91久久在线视频| 欧美精品一区二区蜜臀亚洲| 99这里只有精品| 欧美一级网站| 18成人免费观看视频| 欧美国产一区在线| 一区二区三区免费网站| 久久激情五月婷婷| 亚洲国产专区| 国产精品久久久久久模特| 欧美有码视频| 亚洲精品一区二| 欧美与黑人午夜性猛交久久久| 黄页网站一区| 欧美日韩不卡合集视频| 午夜精品亚洲| 欧美激情第3页| 性欧美1819sex性高清| 伊人激情综合| 国产精品久线观看视频| 毛片一区二区三区| 亚洲图中文字幕| 欧美激情一区二区三区在线视频| 亚洲一区二区在线免费观看视频 | 国产情侣久久| 欧美成人一区二区在线| 午夜精品久久久久久久白皮肤| 欧美高清在线观看| 亚洲欧美视频一区| 亚洲精品中文字幕在线| 国产日韩在线一区二区三区| 欧美成年人网| 久久大香伊蕉在人线观看热2| 亚洲日本国产| 欧美成人久久| 久久久激情视频| 亚洲性av在线| 99精品国产一区二区青青牛奶| 国产亚洲一本大道中文在线| 欧美精品一区二区三| 久久嫩草精品久久久精品| 亚洲一区精彩视频| 日韩小视频在线观看| 欧美成人在线免费视频| 久久久水蜜桃| 欧美在线看片a免费观看| 亚洲影院免费| 一区二区激情视频| 日韩网站在线| 日韩一级精品视频在线观看| 亚洲高清自拍| 亚洲国产精品小视频| 国内精品久久久久久久影视麻豆 | 99国产精品国产精品久久| 在线观看视频欧美| 韩国精品久久久999| 国产一区二区三区视频在线观看| 欧美性久久久| 国产精品成人一区二区三区夜夜夜 | 亚洲高清在线精品| 欧美国产日韩精品免费观看| 麻豆乱码国产一区二区三区| 久久人人97超碰人人澡爱香蕉| 香蕉精品999视频一区二区 | 亚洲美女在线视频| 亚洲精品欧美日韩专区| 亚洲免费观看高清在线观看| 亚洲美女精品一区| aa亚洲婷婷| 亚洲综合视频在线| 欧美在线视频观看免费网站| 欧美在线免费视屏| 久久男人av资源网站| 美女国产一区| 亚洲黄网站在线观看| 99精品国产热久久91蜜凸| 一区二区三区高清在线| 亚洲欧美日韩精品久久久| 久久精品成人| 牛牛国产精品| 欧美性猛交视频| 国产日韩欧美一区二区三区在线观看 | 久久久99久久精品女同性| 久久躁狠狠躁夜夜爽| 亚洲高清在线观看| 在线视频欧美日韩| 欧美亚洲免费电影| 久久综合给合| 欧美日韩在线一区二区三区| 国产精品综合久久久| 亚洲动漫精品| 亚洲综合欧美日韩| 欧美1区3d| 亚洲视频在线观看一区| 久久精品成人| 欧美三区不卡| 在线观看不卡| 亚洲一级网站| 久久综合影音| 日韩午夜在线观看视频| 欧美一区日韩一区| 欧美久久久久久久久久| 国产无一区二区| 亚洲欧洲一区二区天堂久久| 亚洲欧美日韩电影| 亚洲国产美女| 欧美一区二区在线播放| 欧美日韩国产高清| 一区二区三区在线高清| 亚洲尤物在线| 欧美激情亚洲精品| 欧美专区一区二区三区| 欧美日韩直播| 亚洲黄色有码视频| 久久久久.com| 亚洲一二三区视频在线观看| 欧美精品在线观看| 亚洲福利在线视频| 久久精品亚洲一区| 亚洲一区二区精品在线| 欧美日本一区二区视频在线观看 | 欧美日韩在线视频观看|