AtCoder Beginner Contest 399 풀이
A - Hamming Distance
문제 설명
두 문자열 S와 T가 주어졌을 때, 서로 다른 문자의 개수를 구한다.
풀이 방법
문자열을 순회하며 각 위치의 문자가 다를 때마다 카운트를 증가시킨다.
코드
코드 보기
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
string s, t;
...
5월 25일 08:20에 게시됨
AtCoder ABC388 문제 풀이 분석
A - UPC 조합
문제 개요
입력 문자열의 첫 번째 글자 뒤에 "UPC"를 붙여 출력한다.
핵심 아이디어
문자열 인덱싱을 활용한 단순 구현.
구현
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string str;
cin >> str;
cout << str.front() << "UPC" <&l ...
5월 22일 13:43에 게시됨