C언어/문제풀다 하나씩
#include <string> 두번째 기능 a+b = c
mcdn
2020. 5. 13. 16:46
반응형
#include <iostream>
#include <string>
using namespace std;
int main(){
int n;
cin >> n;
string t[10];
for (int i = 0; i < n;i++) {
cin >> t[i];
}
int cnt = 0;
for (int i = 0; i < n - 1;i++) {
for (int j = i + 1;j < n;j++) {
string c = t[i] + t[j];
if (c == "HITSMUSIC") {
cnt++;
}
}
}
cout << cnt;
}
이중for문 이용해서 푸는 string c = t[i] + t[j]
반응형