-
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.
- Loading branch information
0 parents
commit 394afc9
Showing
635 changed files
with
11,529 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,55 @@ | ||
#include<iostream> | ||
#include<string> | ||
#include<algorithm> | ||
using namespace std; | ||
int main(){ | ||
string temp; | ||
cin >> temp; | ||
|
||
for(int i=0; i< temp.size(); i++){ | ||
if(temp[i]>='A' && temp[i] <= 'Z') | ||
temp[i]=temp[i]-'A'+'a'; | ||
} // 1단계 | ||
cout << temp << endl; | ||
|
||
for(int i=0; i< temp.size(); i++){ | ||
if ((temp[i]>='a' && temp[i] <= 'z') || (temp[i]>='0' && temp[i] <= '9') || temp[i]== '-' || temp[i]== '_' || temp[i]== '.'){ | ||
} | ||
else | ||
temp[i]='!'; | ||
} | ||
temp.erase(remove(temp.begin(),temp.end(),'!'),temp.end()); //2단계 | ||
cout << temp << endl; | ||
|
||
for(int i=0; i< temp.size(); i++){ | ||
if (temp[i]=='.' && temp[i+1]=='.'){ | ||
temp[i]='!'; | ||
} | ||
} | ||
temp.erase(remove(temp.begin(),temp.end(),'!'),temp.end()); //3단계 | ||
cout << temp << endl; | ||
|
||
if(temp[0]=='.') | ||
temp.erase(0,1); | ||
if(temp[temp.size()-1]=='.') | ||
temp.erase(temp.size()-1); // 4단계 | ||
cout << temp << endl; | ||
|
||
if (temp == "") | ||
temp = "a"; // 5단계 | ||
cout << temp << endl; | ||
|
||
if(temp.size()>=15) | ||
temp=temp.substr(0,15); // 6단계 | ||
cout << temp << endl; | ||
|
||
if(temp.size()<=2){ | ||
while(temp.size()!=3){ | ||
temp+=temp[temp.size()-1]; | ||
} | ||
} // 7단계 | ||
|
||
cout << temp << endl; | ||
|
||
|
||
} |
Binary file not shown.
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,45 @@ | ||
#include<iostream> | ||
#include<string> | ||
#include<vector> | ||
#include<algorithm> | ||
using namespace std; | ||
|
||
bool includestring(string a, string b){ | ||
int cnt=0; | ||
for(int i=0;i<b.size();i++) { | ||
if(a.find(b[i])!= string::npos) | ||
cnt++; | ||
} | ||
if(cnt==b.size()) | ||
return true; | ||
else | ||
return false; | ||
} | ||
|
||
bool includechar(string a, char b){ | ||
if(a.find(b)!= string::npos) | ||
return true; | ||
else | ||
return false; | ||
} | ||
|
||
int main(){ | ||
vector<string> orders= {"ABCFG", "AC", "CDE", "ACDE", "BCFG", "ACDEH"}; | ||
|
||
string alphabet=""; | ||
for(int i=0; i<orders.size();i++){ | ||
string s = orders.at(i); | ||
for(int j=0;j< s.size();j++){ | ||
if(includechar(alphabet,s[j])){ | ||
} | ||
else{ | ||
alphabet+=s[j]; | ||
} | ||
} | ||
} | ||
sort(alphabet.begin(),alphabet.end()); //메뉴 모두 저장 | ||
|
||
|
||
vector<int> course = {2,3,4}; | ||
|
||
} |
Binary file not shown.
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,11 @@ | ||
#in#include<iostream> | ||
#include<string> | ||
#include<vector> | ||
#include<algorithm> | ||
using namespace std; | ||
int main(){ | ||
vector<string> info= {"java backend junior pizza 150","python frontend senior chicken 210","python frontend senior chicken 150","cpp backend senior pizza 260","java backend junior chicken 80","python backend senior chicken 50"}; | ||
vector<string> query = {"java and backend and junior and pizza 100","python and frontend and senior and chicken 200","cpp and - and senior and pizza 250","- and backend and senior and - 150","- and - and - and chicken 100","- and - and - and - 150"}; | ||
|
||
cout<< orders.at(3); | ||
} |
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,8 @@ | ||
#include<iostream> | ||
#include<typeinfo> | ||
#include<string> | ||
using namespace std; | ||
int main(){ | ||
string s= "Hello"; | ||
cout << typeid(s[2]).name(); | ||
} |
Binary file not shown.
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,65 @@ | ||
#include <iostream> | ||
#include <vector> | ||
#include <string> | ||
using namespace std; | ||
|
||
int main(){ | ||
vector<string> id_list; | ||
vector<string> report; | ||
id_list.push_back("muzi"); | ||
id_list.push_back("frodo"); | ||
id_list.push_back("apeach"); | ||
id_list.push_back("neo"); | ||
report.push_back("muzi frodo"); | ||
report.push_back("apeach frodo"); | ||
report.push_back("frodo neo"); | ||
report.push_back("muzi neo"); | ||
report.push_back("apeach muzi"); | ||
|
||
int members=id_list.size(); | ||
int record[members][members]={0,0,0,0,}; | ||
|
||
for (int i=0; i<report.size();i++){ | ||
string r=report.at(i); | ||
string reporter=r.substr(0,r.find(" ")); | ||
int numreporter; | ||
string reported=r.substr(r.find(" ")+1,r.size()); | ||
int numreported; | ||
for(int j=0; j<members; j++){ | ||
if(reporter == id_list.at(j)) | ||
numreporter=j; | ||
if(reported == id_list.at(j)) | ||
numreported=j; | ||
} | ||
record[numreporter][numreported]++; | ||
} | ||
|
||
int k=2; | ||
|
||
bool isstop[members]; | ||
for(int i=0; i<members;i++){ | ||
int result=0; | ||
for (int j=0; j<members; j++){ | ||
if(record[j][i]>0) | ||
result++; | ||
} | ||
if(result>=k) | ||
isstop[i]= true; | ||
else | ||
isstop[i]=false; | ||
} | ||
|
||
vector<int> answer; | ||
for(int i=0; i<members; i++){ | ||
int result=0; | ||
for (int j=0; j<members; j++){ | ||
if(record[i][j]>0 && isstop[j]==true) | ||
result++; | ||
} | ||
answer.push_back(result); | ||
} | ||
|
||
for(int i=0; i<members; i++){ | ||
cout << answer.at(i) << ' '; | ||
} | ||
} |
Binary file not shown.
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,51 @@ | ||
#include<iostream> | ||
#include<string> | ||
using namespace std; | ||
string changebase(int n, int k){ | ||
string temp=""; | ||
while(n){ | ||
temp+= to_string(n%k); | ||
n/=k; | ||
} | ||
string result=""; | ||
for(int i=temp.size()-1; i>=0; i--){ | ||
result+=temp[i]; | ||
} | ||
return result; | ||
} | ||
|
||
bool isprime(unsigned long long s){ | ||
if(s==0 || s==1) | ||
return false; | ||
else if(s==2 || s==3) | ||
return true; | ||
for(unsigned long long i=2; i*i<=s; i++){ | ||
if(s%i==0) | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
int main(){ | ||
int n,k; | ||
cin >> n >> k; | ||
string str=changebase(n,k); | ||
int answer=0; | ||
while(str.size()>0){ | ||
if(str.find("0")==string::npos){ | ||
if(isprime(stoull(str))){ | ||
answer++; | ||
} | ||
break; | ||
} | ||
string temp=str.substr(0,str.find("0")); | ||
if(isprime(stoull(temp))){ | ||
answer++; | ||
} | ||
str=str.substr(str.find("0")+1,str.size()); | ||
while(str[0]=='0'){ | ||
str=str.substr(1,str.size()); | ||
} | ||
} | ||
cout << answer; | ||
} |
Binary file not shown.
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,103 @@ | ||
#include<iostream> | ||
#include<string> | ||
#include<vector> | ||
#include<tuple> | ||
#include<algorithm> | ||
using namespace std; | ||
|
||
int count(vector<tuple<int, string, int>> p, string s){ | ||
int cnt=0; | ||
for(int i=0;i<p.size();i++){ | ||
if(get<1>(p.at(i))==s) | ||
cnt++; | ||
} | ||
return cnt; | ||
} | ||
|
||
int main(){ | ||
vector<int> fees; | ||
vector<string> records; | ||
fees.push_back(180); | ||
fees.push_back(5000); | ||
fees.push_back(10); | ||
fees.push_back(600); | ||
records.push_back("05:34 5961 IN"); | ||
records.push_back("06:00 0000 IN"); | ||
records.push_back("06:34 0000 OUT"); | ||
records.push_back("07:59 5961 OUT"); | ||
records.push_back("07:59 0148 IN"); | ||
records.push_back("18:59 0000 IN"); | ||
records.push_back("19:09 0148 OUT"); | ||
records.push_back("22:59 5961 IN"); | ||
records.push_back("23:00 5961 OUT"); | ||
|
||
vector<tuple<int, string, int>> carrecord; | ||
|
||
for(int i=0; i<records.size();i++){ | ||
string temp=records.at(i); | ||
cout << temp << endl; | ||
temp=temp.substr(temp.find(" ")+1,temp.size()); | ||
string carnum=temp.substr(0,temp.find(" ")); | ||
|
||
temp=records.at(i); | ||
string hour=temp.substr(0,temp.find(":")); | ||
string minuite=temp.substr(temp.find(":")+1,temp.find(" ")); | ||
int time=stoi(hour)*60+stoi(minuite); | ||
cout << time << endl; | ||
if(i==0) | ||
carrecord.push_back({time,carnum,1}); | ||
else | ||
carrecord.push_back({time, carnum,count(carrecord,carnum)+1}); | ||
} | ||
|
||
vector<pair<int, string>> timepercar; | ||
for(int i=0; i<carrecord.size(); i++){ | ||
cout << get<0>(carrecord.at(i)) << ' ' << get<1>(carrecord.at(i)) << ' ' << get<2>(carrecord.at(i)) << '\n'; | ||
if(get<2>(carrecord.at(i))==1) | ||
timepercar.push_back({-get<0>(carrecord.at(i)),get<1>(carrecord.at(i))}); | ||
else { | ||
for(int j=0; j<timepercar.size();j++){ | ||
if(timepercar.at(j).second==get<1>(carrecord.at(i))){ | ||
if(get<2>(carrecord.at(i))%2==0) | ||
timepercar.at(j).first+=get<0>(carrecord.at(i)); | ||
else | ||
timepercar.at(j).first-=get<0>(carrecord.at(i)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
int basictime=fees.at(0); | ||
int basicfee=fees.at(1); | ||
int unittime=fees.at(2); | ||
int addfee=fees.at(3); | ||
|
||
vector <pair<int, int>> feepercar; | ||
for(int i=0; i<timepercar.size();i++){ | ||
if(timepercar.at(i).first<0) | ||
timepercar.at(i).first+=(60*23+59); | ||
cout <<timepercar.at(i).first << ' ' << timepercar.at(i).second << '\n'; | ||
int time=timepercar.at(i).first; | ||
string carnum=timepercar.at(i).second; | ||
|
||
int price; | ||
if( time <= basictime) | ||
price=basicfee; | ||
else { | ||
price=basicfee; | ||
int addtime=time-basictime; | ||
if(addtime%unittime==0) | ||
price+= (addfee* (addtime/unittime)); | ||
else | ||
price+= (addfee* ((addtime/unittime)+1)); | ||
} | ||
|
||
feepercar.push_back({stoi(carnum),price}); | ||
} | ||
|
||
sort(feepercar.begin(),feepercar.end()); | ||
for(int i=0;i<feepercar.size();i++){ | ||
cout <<feepercar.at(i).first << ' ' << feepercar.at(i).second << '\n'; | ||
} | ||
} |
Binary file not shown.
Oops, something went wrong.