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

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>
            亚洲欧美在线观看| 欧美日韩精品欧美日韩精品| 亚洲国产一区二区三区在线播| 免费欧美在线视频| 欧美va天堂| 亚洲视频欧美在线| 亚洲特色特黄| 国产一区二区三区免费不卡| 老司机精品导航| 欧美丰满高潮xxxx喷水动漫| 亚洲图片欧美一区| 性欧美精品高清| 亚洲二区精品| 亚洲理伦在线| 国产欧美一区二区视频| 另类国产ts人妖高潮视频| 欧美.日韩.国产.一区.二区| 亚洲天堂男人| 欧美在线免费看| 亚洲美女免费精品视频在线观看| 中日韩在线视频| 国产综合久久| 亚洲精品久久久久| 欧美日韩在线观看视频| 久久久久亚洲综合| 欧美国产精品劲爆| 欧美在线不卡视频| 美女91精品| 午夜精品视频网站| 麻豆成人在线| 亚洲欧美国产视频| 老巨人导航500精品| 亚洲一区二区三区精品视频| 久久精品日产第一区二区三区| 99精品视频一区二区三区| 欧美三区免费完整视频在线观看| 香蕉成人久久| 欧美11—12娇小xxxx| 午夜一区二区三区在线观看| 久久亚洲二区| 午夜伦理片一区| 媚黑女一区二区| 欧美一级午夜免费电影| 久久乐国产精品| 亚洲女ⅴideoshd黑人| 久久久一区二区| 亚洲欧美国产另类| 欧美黄色免费网站| 久久躁日日躁aaaaxxxx| 国产精品xvideos88| 欧美韩日一区| 国产一区二区三区四区hd| 亚洲靠逼com| 亚洲国产精品一区二区尤物区| 亚洲在线网站| 一区二区三区久久精品| 老鸭窝91久久精品色噜噜导演| 午夜久久资源| 欧美日韩国产一区二区三区地区| 久久综合久久综合九色| 国产精品视频一二| 亚洲日本久久| 亚洲福利在线视频| 欧美一区二区三区精品| 亚洲综合清纯丝袜自拍| 欧美国产精品劲爆| 欧美刺激午夜性久久久久久久| 国产精品婷婷| 亚洲日本va午夜在线影院| 一区二区在线观看视频| 午夜精品成人在线视频| 亚洲中字在线| 欧美精品色一区二区三区| 美国成人毛片| 国产午夜精品美女视频明星a级| 亚洲美女视频网| 亚洲精品色图| 麻豆视频一区二区| 美女视频黄 久久| 国产一区二区精品久久99| 一区二区三区国产盗摄| 一本色道精品久久一区二区三区 | 国产精品视频自拍| 日韩午夜黄色| 亚洲国产一二三| 久久免费国产| 久久综合色8888| 国内精品久久久久久久影视蜜臀 | 亚洲特级毛片| 欧美日韩国产亚洲一区| 亚洲精品日韩在线| 91久久综合| 亚洲国产一区二区三区高清| 久久综合影音| 欧美阿v一级看视频| 在线播放中文一区| 久久久久成人精品| 美日韩精品视频免费看| 精品不卡一区二区三区| 久久福利电影| 玖玖综合伊人| 亚洲大胆视频| 免费看亚洲片| 亚洲成色精品| 亚洲精品孕妇| 欧美日韩国产精品一区| 亚洲免费精彩视频| 国产精品99久久99久久久二8| 欧美日韩精品综合| 一区二区欧美亚洲| 亚洲欧美精品在线| 国产免费亚洲高清| 久久不射网站| 欧美.www| 日韩一区二区电影网| 欧美日韩一区二区三区在线看 | 亚洲一区二区日本| 国产精品每日更新| 亚洲图片欧美午夜| 久久精品国产99国产精品| 国产色综合天天综合网| 欧美一区二区啪啪| 久久激情一区| 伊人久久大香线| 美国成人直播| 亚洲九九精品| 西西裸体人体做爰大胆久久久| 国产美女精品免费电影| 久久狠狠一本精品综合网| 欧美aaa级| 一本一本久久a久久精品牛牛影视| 欧美视频福利| 午夜精品在线| 欧美成人激情视频免费观看| 日韩一区二区电影网| 欧美午夜免费影院| 欧美一区成人| 亚洲第一黄色网| 亚洲一区二区精品在线观看| 国产喷白浆一区二区三区| 久久全国免费视频| 亚洲欧洲精品一区二区三区 | 欧美成人性生活| 夜夜嗨一区二区| 久久成人18免费网站| 亚洲国产成人午夜在线一区 | 国产精品自在在线| 久久成人免费日本黄色| 亚洲国产精品毛片| 亚洲欧美日韩精品久久亚洲区| 国内视频一区| 亚洲视频免费观看| 国模 一区 二区 三区| 欧美成人一品| 亚洲欧美精品suv| 欧美高清一区| 亚洲欧美日韩综合一区| 在线看成人片| 国产精品成人va在线观看| 久久久久九九九| 亚洲激情精品| 校园激情久久| 亚洲日韩视频| 国产精品主播| 欧美国产日产韩国视频| 午夜亚洲福利| 亚洲精品乱码久久久久久久久| 久久国产精品久久久久久久久久| 亚洲人成高清| 国产亚洲激情| 欧美日韩在线观看一区二区| 久久国产一区二区三区| 在线视频免费在线观看一区二区| 麻豆精品一区二区av白丝在线| 亚洲一区久久| 亚洲国产成人tv| 国产美女高潮久久白浆| 欧美日本一区| 久久免费视频这里只有精品| 亚洲一区二区高清视频| 欧美高清不卡在线| 欧美中文字幕| 亚洲视频在线观看| 亚洲国产日韩一区二区| 国产无遮挡一区二区三区毛片日本| 欧美国产在线视频| 久久精品国产精品亚洲综合| 一区二区三区欧美在线观看| 亚洲福利视频一区二区| 性欧美在线看片a免费观看| 日韩一区二区免费高清| 精品va天堂亚洲国产| 国产欧美精品国产国产专区| 欧美人与禽性xxxxx杂性| 狂野欧美激情性xxxx| 欧美一区二区三区在线观看视频| aⅴ色国产欧美| 亚洲成人中文| 欧美1区3d| 久久蜜桃资源一区二区老牛 |