HDUOJ 2560 The Seven Percent Solution

#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);
        }
    }
}

原文地址:https://www.cnblogs.com/DaiShuSs/p/9607506.html

时间: 2024-08-29 12:45:57

HDUOJ 2560 The Seven Percent Solution的相关文章

zoj 2932 The Seven Percent Solution

The Seven Percent Solution Time Limit: 2 Seconds      Memory Limit: 65536 KB Uniform Resource Identifiers (or URIs) are strings like http://icpc.baylor.edu/icpc/, mailto:[email protected], ftp://127.0.0.1/pub/linux, or even just readme.txt that are u

(HDUStep 1.2.5)The Seven Percent Solution(字符串的替换)

题目: The Seven Percent Solution Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2637 Accepted Submission(s): 1562   Problem Description Uniform Resource Identifiers (or URIs) are strings like http:

题目1.2.4 The Seven Percent Solution(C++)

Problem Description Uniform Resource Identifiers (or URIs) are strings like http://icpc.baylor.edu/icpc/, mailto:[email protected], ftp://127.0.0.1/pub/linux, or even just readme.txt that are used to identify a resource, usually on the Internet or a

POJ 3650 &amp; ZJU 2932 &amp; HDU 2719 The Seven Percent Solution(模拟)

题目链接: PKU:http://poj.org/problem?id=3650 ZJU:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1931 HDU:http://acm.hdu.edu.cn/showproblem.php?pid=2719 Description Uniform Resource Identifiers (or URIs) are strings like http://icpc.baylor.edu

【转】100本最棒的英文侦探小说

阅读计划2:100本最棒的英文侦探小说2010-08-15 13:21:28The Top 100 Crime Novels of All Time The Top 100 Crime Novels of All Time is a list published in book form in 1990 by the British-based Crime Writers' Association. Five years later, the Mystery Writers of America

美国100部推理小说排行榜

这份书单是美国推理作家协会(The Mystery Writers of America,简称MWA)票选出来的史上最经典的一百部推理小说排行榜.评选过程极为复杂,首先由推理协会选出本格派.硬汉派.惊悚派.间谍小说等推理小说十个主要流派的十个代表作家,再由这十个作家选出各流派的十部代表作品,然后由协会会员投票排出名次.所以这份书单不仅仅有总的一百强排行榜,还有各个不同流派的十大杰作排名,其中本格和硬汉两派由于名作数量远远超出其它各派,所以都各排了二十部作品. 后来美国出了一本书<The Crow

HustOJ - 1029

1 #include<iostream> 2 #include<string> 3 using namespace std; 4 int main() 5 { 6 int i=0; 7 string s; 8 while(getline(cin,s)) 9 { 10 if (s[0]=='#') break; 11 else 12 { 13 for (i=0;i<s.size();i++) 14 { 15 if (s[i]==' ') cout<<"%2

HDUOJ P1702 ACboy needs your help again!

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8599    Accepted Submission(s): 4306 Problem Description ACboy was kidnapped!! he miss his mother very much and is very scare now.You can't image

Solution to Triangle by Codility

question: https://codility.com/programmers/lessons/4 we need two parts to prove our solution. on one hand, there is no false triangular. Given the array has been sorted, if A[i]+A[i+1]>A[i+2], we can prove the existence of the triangle. for array A i