41. 生成字典

WHYNBNB

把自己醉倒了

python什么都没学,硬要用python解题的下场就是浪费时间
WA都快把自己弄哭了,后来用print()直接打印,居然对了一个答案
把print()出来的结果和认真写编译出来的结果对比
惊奇的发现每行都多了一个回车,后来才意识到打印字典的键自带回车

这也太神奇了吧

Brown897

果然,只会写水题,,,,,

#include <iostream>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <set>

using namespace std;

set<string> se;

int main() {
    string s,temp;
    getline(cin,s);
    istringstream ss(s);
    while(ss >> temp){
        if (islower(temp[0])) temp[0] = temp[0]-32;
        se.insert(temp);
    }
    for(set<string>::iterator it = se.begin();it!=se.end();it++){
        temp = *it;
        cout<<temp[0]<<":"<<temp<<endl;
    }

    return 0;
}
存在问题!
||||
 
你当前正在回复 博客/题目 100:0