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

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| 国产色婷婷国产综合在线理论片a| 亚洲人人精品| 亚洲国产小视频在线观看| 久久久久**毛片大全| 国语对白精品一区二区| 久久久久久久网站| 久久精品视频在线观看| 在线免费不卡视频| 亚洲国产精品综合| 欧美色网在线| 久久精品99久久香蕉国产色戒| 小处雏高清一区二区三区| 国产一区日韩二区欧美三区| 快射av在线播放一区| 狂野欧美激情性xxxx欧美| 99精品99| 欧美一区二区三区成人| 亚洲高清在线精品| 中文亚洲视频在线| 激情小说亚洲一区| 亚洲人www| 国产欧美日韩视频一区二区| 免费亚洲视频| 国产精品久久久久久久久久久久久| 欧美一区二区三区在| 久久中文字幕一区二区三区| av成人动漫| 久久精品亚洲一区| 在线亚洲欧美视频| 亚洲欧美中文日韩v在线观看| 亚洲电影av在线| 亚洲视频 欧洲视频| 在线激情影院一区| 亚洲一卡二卡三卡四卡五卡| 亚洲综合成人在线| 最新亚洲视频| 欧美在线视频a| av成人免费在线| 久久精品欧美日韩精品| 亚洲一区黄色| 欧美国产在线电影| 裸体歌舞表演一区二区| 国产精品国产a| 亚洲黄网站在线观看| 国产在线高清精品| 中日韩男男gay无套| 亚洲人成在线影院| 麻豆精品视频在线观看视频| 亚洲欧美日韩直播| 欧美人与禽猛交乱配| 欧美激情va永久在线播放| 国产色婷婷国产综合在线理论片a| 亚洲欧洲在线一区| 精品成人国产| 午夜精品亚洲| 欧美一区日本一区韩国一区| 欧美精品综合| 亚洲日本aⅴ片在线观看香蕉| 亚洲国产成人精品女人久久久 | 亚洲免费网站| 欧美激情一区二区三区在线视频观看| 久久久亚洲国产美女国产盗摄| 国产欧美一区二区精品秋霞影院| 日韩视频精品在线观看| 亚洲精品国产精品国自产观看浪潮| 欧美在线亚洲一区| 久久青青草综合| 黄色小说综合网站| 久久久久99精品国产片| 狠狠色综合网| 久久成人这里只有精品| 久久精品五月婷婷| 精品盗摄一区二区三区| 欧美中文字幕第一页| 久久精品综合网| 在线不卡亚洲| 鲁鲁狠狠狠7777一区二区| 欧美成人按摩| 99人久久精品视频最新地址| 欧美日韩国产精品一区| 在线综合亚洲| 欧美一区二区三区四区高清| 国产亚洲福利| 久久久久亚洲综合| 亚洲国产精品福利| 亚洲天堂久久| 国产亚洲欧美另类一区二区三区| 先锋亚洲精品| 亚洲丁香婷深爱综合| 国产精品www994| 羞羞漫画18久久大片| 老司机成人网| 一片黄亚洲嫩模| 国产精品私房写真福利视频| 久久国产一二区| 91久久精品美女| 欧美在线首页| 亚洲激情在线观看视频免费| 欧美日韩国产一中文字不卡 | 性欧美videos另类喷潮| 韩国成人精品a∨在线观看| 母乳一区在线观看| 亚洲午夜精品一区二区三区他趣| 久久久一二三| 中日韩在线视频| 精品福利av| 国产精品美女久久久久久2018| 久久不射网站| 亚洲视频在线播放| 美女视频黄免费的久久| 亚洲一二三区在线| 精品成人国产在线观看男人呻吟| 欧美日韩日本视频| 亚洲欧洲一区二区天堂久久| 欧美一区成人| 亚洲视频一区二区| 亚洲电影网站| 国产午夜精品久久久久久免费视 | 欧美jizz19hd性欧美| 亚洲一区二区久久| 91久久久精品| 欧美激情网友自拍| 久久久久一本一区二区青青蜜月| 日韩一区二区精品| 亚洲国产高清一区二区三区| 国产伦精品一区| 欧美视频四区| 欧美日韩国产欧| 免费观看30秒视频久久| 欧美一区二区精品久久911| 一道本一区二区| 亚洲精品乱码久久久久久黑人| 你懂的视频一区二区| 久久久免费观看视频| 欧美影院成人| 欧美主播一区二区三区| 亚洲欧美激情在线视频| 这里是久久伊人| 亚洲视频一区二区| av成人免费在线观看| 亚洲毛片视频| 亚洲美女视频网| 99精品国产热久久91蜜凸| 亚洲国产精品成人va在线观看| 极品av少妇一区二区| 国产一区二区三区久久久久久久久 | 亚洲精品视频在线| 亚洲人成小说网站色在线| 亚洲黄色片网站| 亚洲欧洲另类| 亚洲片国产一区一级在线观看| 亚洲国内自拍| 亚洲精品一区二区网址| 日韩视频在线观看免费| 99在线精品视频| 亚洲一区二区三区精品视频| 亚洲图片在线| 午夜精品理论片| 久久久久青草大香线综合精品| 久久婷婷久久| 欧美绝品在线观看成人午夜影视 | 亚洲自拍另类| 欧美主播一区二区三区| 久久精品首页| 欧美黄色片免费观看| 欧美午夜一区二区三区免费大片| 欧美视频在线观看一区| 国产区日韩欧美| 亚洲第一在线| 亚洲一级在线| 噜噜爱69成人精品| 亚洲国产婷婷香蕉久久久久久99| 99成人精品| 欧美在线视频日韩| 欧美1区2区| 国产精品一区二区视频| 一区二区亚洲精品| 亚洲视频视频在线| 久久久久天天天天| 亚洲久久一区二区| 香蕉久久精品日日躁夜夜躁| 麻豆精品精华液| 国产精品久久久久77777| 精品99视频| 亚洲一区二区视频在线| 麻豆9191精品国产| 亚洲深夜福利| 欧美成人午夜激情视频| 国产精品亚洲综合天堂夜夜| 亚洲国产精品www| 久久精品导航| 日韩一二三区视频| 久久免费精品视频| 国产精品久久久久av| 亚洲国产婷婷| 久久午夜av| 亚洲天堂成人| 欧美国产精品日韩|