ZCMU-1128

Detailed questions, take notes (I feel getting better and better recently, write the details for a long time)

Article Directory


topic

1128: Chapter 4: Whoever loves first loses

Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 483 Solved: 114
[Submit][Status][Web Board]
Description

Sometimes it's just so strange. Zheng Wei had never heard of or discovered the existence of this person before going on the bar with Chen Xiao that night. Of course, maybe he has passed by her countless times, and maybe someone has mentioned this name in front of her, consciously or unconsciously, but the person and this name at the time were meaningless to Zheng Wei. So she didn't realize it, but when she started paying attention to this guy, she realized that he was everywhere.

Originally, the Department of Architecture and the Department of Civil Engineering belonged to the same college, and they were still closely related to each other, and they were in the same teaching building. And Zheng Wei was also surprised to find that this guy is actually quite famous. Many people in the courtyard have heard of him. It is nothing more than the number one who was admitted with high scores last year. His results are quite good. He has won awards in architectural model design competitions. of. It’s similar to what Ruan Ruan said. The old scholar of engineering graphics also mentioned him in class, as if she was a proud student. She even heard Li Weijuan (Zheng Wei’s roommate) at the slumber meeting. Hearing his name, Li Weijuan, who has always been arrogant and arrogant, also yearned for him.

How exactly did Zheng Wei and Chen Xiao get along? It is actually a C language program code! Please uncomment this C language code.

Input

The input data contains some lines of code that conform to the C language syntax.

Output

Output C language code without double slash comments. Except for the comment code, the format of the original sentence line remains unchanged, and there should be no spaces at the end of the line. If there are only comments on the entire line, then you should ignore this line.

Sample Input

//======================
// simplest program
//======================
#include<stdio.h>
#include<math.h>
//----------------------
int main(){
    
    
    printf("My World!\n");
    return 0;
}//---------------------

Sample Output

#include<stdio.h>
#include<math.h>
int main(){
    
    
    printf("My World!\n");
    return 0;
}

AC code

Small details: Note that // may be used as output content rather than as a comment, here is a special judgment

#include<stdio.h>
#include<string.h>
#include<queue>
#include<iostream>
using namespace std;
const int INF = -66536 ;
int main()
{
    
    
    string str;
    while(getline(cin,str))
    {
    
    
        int flag1,flag2;
        flag1 = flag2 = 0;
        int n,m;
        n = m = 0;
        int len = str.length();
        for(int i=0;i<len;i++){
    
    
            
            if(str[i]=='/'&&str[i+1]=='/'){
    
    
                for(int j=i;j>=0;j--)if(str[j]=='"')m = 1;
                for(int k=i+2;k<len;k++)if(str[k]=='"')n = 1;
                if(n&&m){
    
    cout << "/";continue;}
                //标记出现过注释
                flag1 = 1;
                if(i>0)flag2 = 1;
                //注释后边的就不用输出了
                break;
            }
            cout << str[i];
        }
            //换行的条件:出现了//或者一整行都没出现过//,末尾换行
            if(flag2||!flag1)
                puts("");
        
        
        
    }
    
    return 0;
}


to sum up

Details questions, nothing to say

Guess you like

Origin blog.csdn.net/DAVID3A/article/details/114652228