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

ACM___________________________

______________白白の屋
posts - 182, comments - 102, trackbacks - 0, articles - 0
<2010年8月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

常用鏈接

留言簿(24)

隨筆分類(332)

隨筆檔案(182)

FRIENDS

搜索

積分與排名

最新隨筆

最新評論

閱讀排行榜

評論排行榜

HDOJ 2714 HDU 2714 ISBN ACM 2714 IN HDU

Posted on 2010-09-25 20:25 MiYu 閱讀(466) 評論(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>
            国产精品免费看片| 亚洲自拍偷拍麻豆| 午夜欧美不卡精品aaaaa| 日韩一区二区精品葵司在线| 精品电影在线观看| 国产婷婷精品| 黑人巨大精品欧美黑白配亚洲| 国产精品蜜臀在线观看| 国产精品网红福利| 国产一区二区三区四区在线观看| 国产伦精品一区二区三区免费迷 | 国产精品久久久久影院色老大 | 亚洲国产精品精华液网站| 久久久久久色| 欧美韩日亚洲| 在线视频欧美日韩精品| 香蕉成人伊视频在线观看 | 午夜精品久久久久久久99樱桃| 午夜精品久久久久久久久久久久| 欧美在线视频在线播放完整版免费观看| 欧美在线观看日本一区| 欧美xx视频| 亚洲永久免费观看| 免费中文字幕日韩欧美| 国产精品乱码久久久久久| 樱花yy私人影院亚洲| 亚洲一区二区精品在线观看| 米奇777超碰欧美日韩亚洲| 日韩午夜在线| 久久久国产一区二区三区| 欧美日本中文| 亚洲国产精品成人| 久久成人羞羞网站| 亚洲欧洲视频| 亚洲欧美三级在线| 欧美高清在线| 激情一区二区| 久久爱www.| 亚洲最新中文字幕| 欧美高清视频免费观看| 激情综合在线| 久久成人免费网| 亚洲视频欧美在线| 欧美喷潮久久久xxxxx| 欧美日韩综合一区| 久久精品视频在线免费观看| 亚洲激情成人在线| 久久噜噜亚洲综合| 国产精品永久免费观看| 一区二区三区四区国产精品| 亚洲福利视频免费观看| 久久亚洲精品一区| 韩国av一区| 久久久久久久欧美精品| 亚洲曰本av电影| 欧美激情女人20p| 国产日韩欧美a| 亚洲欧美视频在线观看| 久久久中精品2020中文| 欧美偷拍另类| 一区二区三区欧美在线| 亚洲电影有码| 美女视频一区免费观看| 影音先锋在线一区| 猛男gaygay欧美视频| 久久国产色av| 黄色成人在线观看| 免费观看不卡av| 老司机精品导航| 亚洲日本中文| 亚洲精品视频在线看| 欧美精品aa| 一本久道久久综合狠狠爱| 亚洲精品久久久久| 欧美三区美女| 久久se精品一区精品二区| 欧美与黑人午夜性猛交久久久| 国产精品女主播一区二区三区| 亚洲一品av免费观看| 亚洲欧美日本日韩| 一色屋精品视频在线看| 亚洲成色精品| 欧美日韩妖精视频| 久久se精品一区精品二区| 久久另类ts人妖一区二区| 一区二区三区在线观看视频 | 亚洲精品国产精品国自产在线| 欧美国产视频日韩| 亚洲一区二区三区三| 欧美亚洲视频一区二区| 亚洲国产精品国自产拍av秋霞| 亚洲精品久久久久久下一站 | 亚洲国产片色| 日韩午夜免费视频| 韩日精品视频| 亚洲美女视频网| 国产在线精品一区二区夜色| 欧美激情第二页| 国产精品入口尤物| 欧美人与禽猛交乱配视频| 亚洲视频在线一区观看| 亚洲激情综合| 国产精品亚洲视频| 欧美成人自拍视频| 国产精品欧美久久久久无广告| 欧美 日韩 国产一区二区在线视频 | 亚洲国产另类久久精品| 一区二区三区.www| 一区二区视频欧美| 在线视频欧美日韩精品| 亚洲精品乱码久久久久久久久| 亚洲欧美日韩在线综合| 夜夜嗨av一区二区三区| 麻豆精品在线观看| 久久精品男女| 国产精品久久夜| 黄色精品免费| 99精品久久免费看蜜臀剧情介绍| 精品成人在线观看| 午夜精品久久久久久久男人的天堂| 亚洲精品久久久久| 久久久最新网址| 久久gogo国模啪啪人体图| 欧美日韩第一区日日骚| 亚洲国产91精品在线观看| 国产一区二区三区的电影 | 浪潮色综合久久天堂| 欧美视频一区| 999在线观看精品免费不卡网站| 激情亚洲一区二区三区四区| 亚洲欧美一区二区在线观看| 亚洲综合精品自拍| 欧美精品在线观看播放| 亚洲国产精品久久久久秋霞不卡| 伊人成人开心激情综合网| 欧美中文在线免费| 久久久久久久波多野高潮日日| 国产农村妇女毛片精品久久麻豆| 一本色道久久精品| 亚洲综合激情| 国产农村妇女精品一区二区| 亚洲欧美成人网| 午夜一区二区三区不卡视频| 欧美三级在线播放| 亚洲一级片在线观看| 亚洲自拍偷拍福利| 国产一区激情| 久久午夜精品| 91久久国产综合久久蜜月精品 | 欧美华人在线视频| 亚洲欧洲一区二区三区| 9l视频自拍蝌蚪9l视频成人| 欧美美女视频| 亚洲少妇在线| 久久精品91| 欧美综合国产| 伊人久久综合97精品| 久久免费少妇高潮久久精品99| 女人色偷偷aa久久天堂| 亚洲精品中文字幕女同| 欧美色另类天堂2015| 欧美亚洲免费| 欧美国产欧美亚洲国产日韩mv天天看完整 | 亚洲一级片在线观看| 国产精品免费网站| 性欧美8khd高清极品| 麻豆91精品| 一区二区三区精品| 国产日韩精品在线| 免费久久99精品国产自在现线| 亚洲人在线视频| 久久成年人视频| 亚洲精品一区二区网址| 国产精自产拍久久久久久蜜 | 欧美日韩亚洲一区二| 午夜精品视频在线观看| 免费看黄裸体一级大秀欧美| 日韩一级在线观看| 国产精品视频yy9099| 麻豆国产精品va在线观看不卡| 亚洲韩国精品一区| 久久久国产视频91| 在线视频中文亚洲| 激情欧美一区二区| 国产精品女人毛片| 欧美激情视频一区二区三区免费| 亚洲欧美日本日韩| 亚洲美女福利视频网站| 久久影视三级福利片| 亚洲天堂成人在线视频| 亚洲成色www8888| 国产精品夜夜嗨| 欧美日韩在线播放三区| 久久亚洲高清| 小黄鸭精品aⅴ导航网站入口| 亚洲精品中文字幕在线| 亚洲大黄网站| 免费看成人av| 久久影视精品| 久久亚洲不卡|