#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
int code[11]={64,32,16,8,4,2,1};
char input[20]={'\0'};
int main(){
freopen("input.txt", "r", stdin);
int end_count=0;
while(1){
int output=0;
gets(input);
//puts(input);
if(input[0]=='_')end_count++;
if(end_count==2)break;
if(input[0]!='_'){
if(input[2]=='o')output+=64;
if(input[3]=='o')output+=32;
if(input[4]=='o')output+=16;
if(input[5]=='o')output+= 8;
if(input[7]=='o')output+= 4;
if(input[8]=='o')output+= 2;
if(input[9]=='o')output+= 1;
printf("%c",output);
}
//system("PAUSE");
}
return 0;
}
2014年9月13日星期六
[UVa] 10878 - Decode the tape
訂閱:
發佈留言 (Atom)
-
因為先前寫UVa時,檔案名稱有時會花心思改,有時就直接把題目名稱加上.cpp就貼上了 導致現在有不同的格式出現 現在要處理的事情很簡單 1. 去除空白 2. 將底線 ( _ ) 換成dash ( - ) 經過一番查詢,終於發現最簡單的方法 - re...
-
文章出處: http://infbugs.blogspot.tw/2011/12/c_20.html 謝謝沙耶,解答了我長久以來對於 input/output 的疑惑。 C 語言入門 - 在線上批改系統練功 如何練習使用基本語法 自己出個練習題試著寫...
-
一開始用數學方法推斷得出,設輸入為n k為在n的前一斜線列數,故只要找到 (1+k)*k/2 < n 的最大k值,即可判定 k%2 == 1 => ((2*n)-(k*k)-k)/2 / ((k*k)+(3*k)-(2*n)+4)/2 k%2 ==...
沒有留言:
發佈留言