Skip to content

Commit

Permalink
Add 10809, 1157, 11653, 11720, 2675
Browse files Browse the repository at this point in the history
10809 알파벳 찾기(문자열)
1157 단어공부(문자열)
11654 아스키코드(문자열)
11720 숫자의 합(문자열)
2675 문자열 반복(문자열)
  • Loading branch information
witheunjin committed Apr 25, 2020
1 parent bb0ddc8 commit a78d884
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 0 deletions.
17 changes: 17 additions & 0 deletions BaekJoon/10809_알파벳 찾기.cpp
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;
}
29 changes: 29 additions & 0 deletions BaekJoon/1157_단어공부.cpp
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;
}
9 changes: 9 additions & 0 deletions BaekJoon/11654_아스키코드.cpp
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;
}
15 changes: 15 additions & 0 deletions BaekJoon/11720_숫자의합.cpp
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;
}
26 changes: 26 additions & 0 deletions BaekJoon/2675_문자열 반복.cpp
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;
}
14 changes: 14 additions & 0 deletions BaekJoon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ https://www.acmicpc.net/
|**10869**|**사칙연산**|2020.03.26|1|
|**2606**|**바이러스**|2020.04.24|2|
|**10870**|**피보나치수5**|2020.04.25|1|
|**11654**|**아스키코드**|2020.04.25|1|
|**11720**|**숫자의 합**|2020.04.25|1|
|**10809**|**알파벳 찾기**|2020.04.25|1|
|**2675**|**문자열 반복**|2020.04.25|2|
|**1157**|**단어 공부**|2020.04.25|3|
|****|****|||
|****|****|||
|****|****|||
|****|****|||
|****|****|||
|****|****|||
|****|****|||
|****|****|||
|****|****|||
|****|****|||
|****|****|||
|****|****|||
Expand Down

0 comments on commit a78d884

Please sign in to comment.