본문 바로가기
반응형

분류 전체보기39

[HackerRank] Classes and Objects - Easy https://www.hackerrank.com/challenges/classes-objects/problem Classes and Objects | HackerRank Familiarize yourself with classes and objects. www.hackerrank.com #include #include #include #include #include #include using namespace std; // Write your Student class here class Student{ private: int scores[5]; int sum; public: Student():sum(0) {} void input(){ for(int i=0;i>scores[i]; } } int calcul.. 2019. 10. 16.
[HackerRank] Strings - Easy https://www.hackerrank.com/challenges/c-tutorial-strings/problem Strings | HackerRank Learn how to input and output strings. www.hackerrank.com #include #include using namespace std; void SwapZeroLoc(char* str1,char* str2); int main() { // Complete the program string f_str,s_str; cin>>f_str; cin.ignore(); getline(cin,s_str); cout 2019. 10. 14.
[HackerRank] StringStream - Easy https://www.hackerrank.com/challenges/c-tutorial-stringstream/problem StringStream | HackerRank Learn how to use stringstreams. www.hackerrank.com istringstream - 문자열 읽기 ostringstream - 문자열 쓰기 stringstrema - 문자열 읽고 쓰기 ">>" - formatted data 추출 " 2019. 10. 14.
[HackerRank]Attribute Parser - Medium https://www.hackerrank.com/challenges/attribute-parser Attribute Parser | HackerRank Parse the values within various tags. www.hackerrank.com #include #include #include #include #include #include using namespace std; map tagMap; void createTag(int& n,string pretag) { if(!n) return; string line,tag,attr,value; getline(cin,line); int i=1; if(line[i]=='/'){ while(line[i]!='>')i++; if(pretag.size()>.. 2019. 10. 14.
[HackerRank] Variable Sized Arrays - Easy https://www.hackerrank.com/challenges/variable-sized-arrays/problem Variable Sized Arrays | HackerRank Find the element described in the query for integer sequences. www.hackerrank.com 입력 예시 2 2 3 1 5 4 5 1 2 8 9 3 0 1 1 3 "2 2"의 첫번째 2는 행의 갯수를 의미하고 두번째 2는 질문의 갯수를 의미함. "3 1 5 4"(3개의 데이터 "1 5 4"를 가지고있음) "5 1 2 8 9 3"("1 2 8 9 3") => 즉, 3과 5는 데이터의 갯수를 입력해주는 것이다. 데이터를 찾을 때 0행의 1열은 5가 나오는것을 찾을 수 있으며 .. 2019. 10. 13.
[HackerRank] Array Introduction - Easy https://www.hackerrank.com/challenges/arrays-introduction/problem Arrays Introduction | HackerRank How to access and use arrays. Print the array in the reverse order. www.hackerrank.com #include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int arrNum,arr[10000]; cin>>arrNum; for(int i=0;i>arr[i]; }.. 2019. 10. 12.
반응형