整形变字符串
stringstream ssa; ssa<<abs(a);
stra = ssa.str();
今天用了一下不过超时了
这里的输入需要记录一下 G - Andy's First Dictionary
https://vjudge.net/contest/359711#problem/G
#include<bits/stdc++.h> #define N 10 #define endl ' ' #define _for(i,a,b) for(int i=a;i<b;i++) using namespace std; typedef long long ll; set<string> Set; int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); string s; while( getline( cin,s ) ){ int len = s.size(); _for(i,0,len){ if( isalpha(s[i]) ){ if( s[i]<'a' ) s[i]=s[i]-'A'+'a'; } else s[i] = ' '; } stringstream ss(s); string tem; while( ss>>tem ){ // cout<<tem<<endl; Set.insert(tem); } } for( auto i : Set) cout<<i<<endl; return 0; }
usingnamespacestd; typedeflonglong ll; set<string> Set; int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); string s; while( getline( cin,s ) ){ int len = s.size(); _for(i,0,len){ if( isalpha(s[i]) ){ if( s[i]<'a' ) s[i]=s[i]-'A'+'a'; } else s[i] = ' '; } stringstream ss(s); string tem; while( ss>>tem ){ // cout<<tem<<endl; Set.insert(tem); } } for( auto i : Set) cout<<i<<endl; return0; }