1. 程式人生 > >HDUOJ 2560 The Seven Percent Solution

HDUOJ 2560 The Seven Percent Solution

ace code lib () putchar spa getc col eve

#include<iostream>
#include<stdlib.h>
using namespace std;

int main() {
    //第一個循環用於輸入,遇到#停止
    while (1) {
        //第二個循環用於單次輸入的每個字符的判斷
        while (1) {
            char c;
            c = getchar();
            //若遇到換行符,則結束此次輸入
            if (c == \n || c == EOF) {
                cout 
<< endl; break; } //遇到#停止 if (c == #) return 0; //遇到如下替代 if (c == ) cout << "%20"; else if (c == !) cout << "x%21"; else if (c == $) cout << "%24";
else if (c == %) cout << "%25"; else if (c == () cout << "%28"; else if (c == )) cout << "%29"; else if (c == *) cout << "%2a"; //否則直接輸出 else putchar(c); } } }

HDUOJ 2560 The Seven Percent Solution