-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10809 알파벳 찾기(문자열) 1157 단어공부(문자열) 11654 아스키코드(문자열) 11720 숫자의 합(문자열) 2675 문자열 반복(문자열)
- Loading branch information
1 parent
bb0ddc8
commit a78d884
Showing
6 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(void) { | ||
string word; | ||
cin>>word; | ||
vector<int> result; | ||
result = vector<int>(26,-1); | ||
for(int i=0;i<word.size();++i) { | ||
int pos = (int)word[i]-97; | ||
if(result[pos]==-1) result[pos]=i; | ||
} | ||
for(int i=0; i<26;++i) { | ||
cout<<result[i]<<' '; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <iostream> | ||
#include <vector> | ||
using namespace std; | ||
|
||
int main() { | ||
string input; | ||
cin>>input; | ||
int max = 0; | ||
int temp = 0; | ||
int temp2=0; | ||
vector<int> every(26,0); | ||
for(int i=0; i<input.size(); ++i) { | ||
int each = input[i]; | ||
if(97<=each && each<=122) each-=32; | ||
each-=65; | ||
++every[each]; | ||
if(max<every[each]) { | ||
max = every[each]; | ||
temp = each; | ||
} | ||
else if(max == every[each]&&temp!=each){ | ||
temp2 = max; | ||
} | ||
} | ||
|
||
if(temp2==max) cout<<'?'<<endl; | ||
else cout<<(char)(temp+65)<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() { | ||
char input; | ||
cin>>input; | ||
cout<<(int)input<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <iostream> | ||
#include <vector> | ||
using namespace std; | ||
|
||
int main(void) { | ||
vector<string> input; | ||
input.resize(1); | ||
int n=0; | ||
cin>>n; | ||
cin>>input[0]; | ||
int sum = 0; | ||
for(int i=0; i<n; ++i) sum += (int)input[0][i] - 48; | ||
cout<<sum<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <iostream> | ||
#include <vector> | ||
using namespace std; | ||
vector<string> result; | ||
void repeat(int k, int n, const string& str) { | ||
for(int i=0; i<str.size(); ++i) { | ||
for(int j=0; j<n; ++j) { | ||
result[k].push_back(str[i]); | ||
} | ||
} | ||
} | ||
int main() { | ||
int testCase = 0; | ||
cin>>testCase; | ||
int repeatNum = 0; | ||
string input; | ||
result.resize(testCase); | ||
for(int i=0; i<testCase; ++i) { | ||
cin>>repeatNum>>input; | ||
repeat(i, repeatNum, input); | ||
} | ||
for(int i=0; i<testCase; ++i) { | ||
cout<<result[i]<<endl; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters