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

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>
            亚洲一区欧美一区| 99精品国产在热久久下载| 性高湖久久久久久久久| 国产精品久久久久7777婷婷| 亚洲老板91色精品久久| 欧美日韩高清区| 一区二区电影免费在线观看| 在线亚洲国产精品网站| 国产精品视频yy9299一区| 久久久国产亚洲精品| 久久久另类综合| 亚洲人成在线播放| 亚洲一级二级| 精品福利免费观看| 亚洲日本成人| 国产精品欧美在线| 免费不卡在线观看av| 欧美精品色综合| 欧美一级在线视频| 久久婷婷丁香| 亚洲视频在线视频| 久久国产精品电影| 99国产精品99久久久久久粉嫩| 亚洲最新在线| 影音先锋亚洲精品| 日韩亚洲不卡在线| 一区二区亚洲精品国产| 亚洲美女在线视频| 国模精品一区二区三区| 亚洲精品一区在线观看| 国产精品丝袜91| 亚洲国产美女久久久久| 国产欧美丝祙| 亚洲人成亚洲人成在线观看图片 | 欧美在线视频免费观看| 另类国产ts人妖高潮视频| 亚洲午夜伦理| 免费欧美在线| 欧美在线黄色| 欧美日韩久久精品| 欧美国产一区二区三区激情无套| 国产精品久久毛片a| 亚洲国产精品999| 国产日韩欧美一区二区| 日韩视频在线观看免费| 亚洲二区免费| 午夜在线一区| 午夜欧美不卡精品aaaaa| 欧美va日韩va| 免费成人av在线看| 久久伊人免费视频| 国产精品视频一区二区高潮| 亚洲精品小视频| 91久久精品一区二区三区| 久久精品视频在线观看| 久久国产精品99精品国产| 欧美丝袜一区二区| 亚洲精品乱码久久久久久蜜桃91| 黄色免费成人| 久久精品日韩欧美| 久久精品观看| 国产日韩av一区二区| 亚洲一区二区三区中文字幕在线| 亚洲一区成人| 欧美色图五月天| 日韩视频三区| 亚洲一区免费在线观看| 国产精品大片wwwwww| 99热精品在线观看| 亚洲一二三四久久| 国产精品成人在线观看| 亚洲午夜一级| 欧美一区二区三区免费大片| 国产精品你懂的| 午夜精品久久久久久久| 久久精品一本久久99精品| 国产亚洲精品久久久久动| 欧美一区二区视频97| 久久只有精品| 亚洲国产清纯| 欧美日本中文字幕| 亚洲天堂av综合网| 久久久久久久久一区二区| 精品999在线观看| 理论片一区二区在线| 91久久嫩草影院一区二区| 在线视频欧美日韩| 国产精品一二| 久久久成人网| 亚洲精品久久久久中文字幕欢迎你 | 国产精品毛片a∨一区二区三区|国 | 亚洲精华国产欧美| 亚洲人体影院| 欧美亚洲成人网| 欧美一站二站| 亚洲日韩成人| 欧美在线播放一区二区| 永久免费视频成人| 欧美人成在线| 正在播放亚洲一区| 免费观看成人| 亚洲一区综合| 1000部精品久久久久久久久 | 一区二区精品在线| 久久精品国产91精品亚洲| 亚洲国产精品尤物yw在线观看| 欧美另类99xxxxx| 欧美一级淫片播放口| 亚洲国产日韩欧美一区二区三区| 午夜在线视频一区二区区别| 亚洲国产成人精品女人久久久| 欧美视频福利| 久久综合免费视频影院| 亚洲天堂免费观看| 亚洲高清不卡av| 欧美在线亚洲在线| 一区二区动漫| 欧美激情一区三区| 亚洲欧美不卡| 一本色道久久综合精品竹菊 | 伊人久久噜噜噜躁狠狠躁 | 亚洲伊人网站| 亚洲激情图片小说视频| 久久综合图片| 午夜久久美女| 亚洲一区国产精品| 亚洲精品一区二区三区四区高清| 国产亚洲欧美日韩精品| 国产精品久久久999| 欧美精品一区在线发布| 老巨人导航500精品| 久久9热精品视频| 亚洲一区亚洲二区| 一级成人国产| 亚洲精品免费在线观看| 欧美成人在线免费视频| 久久亚洲精品网站| 久久精品国产91精品亚洲| 午夜精品99久久免费| 亚洲一区二区三区在线视频| 一区二区三区色| 亚洲免费播放| 亚洲精一区二区三区| 亚洲国产天堂久久综合网| 亚洲国产高清自拍| 亚洲国产欧美一区| 亚洲精品一区二| 亚洲精品美女在线观看| 亚洲美女精品久久| 一区二区三区免费网站| 一区二区三区四区五区精品| 亚洲午夜电影在线观看| 亚洲一区二区三区影院| 亚洲欧美国内爽妇网| 欧美一区二区三区四区视频| 欧美一级片久久久久久久| 欧美在线视频播放| 久久亚洲精品一区| 亚洲高清免费在线| 亚洲麻豆av| 亚洲一区二区不卡免费| 午夜国产精品视频| 久久久久久尹人网香蕉| 美国十次了思思久久精品导航| 男人天堂欧美日韩| 欧美视频在线免费| 国产亚洲综合性久久久影院| 精品不卡一区| 日韩午夜av| 欧美影院视频| 免费在线成人| 一本色道88久久加勒比精品| 亚洲欧美日韩一区在线| 久久综合电影一区| 欧美日韩视频一区二区| 国产婷婷97碰碰久久人人蜜臀| 国产美女精品免费电影| 在线观看91精品国产入口| 一本色道久久加勒比精品| 久久精品视频免费播放| 亚洲国产精品免费| 亚洲男女毛片无遮挡| 美国成人直播| 国产精品网站一区| 亚洲精品欧美| 久久精品国产亚洲一区二区三区| 欧美国产视频在线| 亚洲男人av电影| 亚洲精品欧美激情| 欧美在线视频免费观看| 亚洲国产综合在线看不卡| 亚洲欧美视频在线| 欧美日韩dvd在线观看| 韩日成人av| 亚洲欧美国产一区二区三区| 欧美成人国产一区二区| 亚洲欧美国产不卡| 欧美精品久久一区二区| 国产午夜精品在线| 亚洲综合精品一区二区|