백준

6,9 따로 떼고 생각해보자 #include using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int cnt[10]={}; while(n>0){ cnt[n%10]++; n/=10; } int set = 1; for(int i =0; i < 10; i++){ if(i == 6 || i == 9) continue; set = max(set,cnt[i]); } set = max(set, (cnt[6]+cnt[9]+1) / 2); cout
풀이1 int를 문자열로 바꾸는것을 통해 아스키코드값을 이용하여 풀 수 있다. #include using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); int a, b, c; int cnt[10]={}; cin >> a >> b >> c; int res = a * b * c; /* std::to_string(val) 숫자(int, long, float, double 등)를 문자열(string)으로 변환하여 반환해주는 함수를 사용한다. */ string s = to_string(res); for( auto x : s){ cnt[x - '0']++; } for( auto y : cnt){ cout a >> b >> c; int res = a..
#include using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, a, b; cin >> n; while(n--){ cin >> a >> b; cout
#include using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout
#include using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int a, b; cin >> a >> b; cout
https://www.acmicpc.net/problem/1021 1021번: 회전하는 큐 첫째 줄에 큐의 크기 N과 뽑아내려고 하는 수의 개수 M이 주어진다. N은 50보다 작거나 같은 자연수이고, M은 N보다 작거나 같은 자연수이다. 둘째 줄에는 지민이가 뽑아내려고 하는 수의 위치가 www.acmicpc.net #include using namespace std; int main(void){ ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; //1)n,m 입력받기 deque DQ; for(int i=1; i > val; int idx = find(DQ.begin(), DQ.end(), val) - DQ.begin(); while(DQ.fro..
Roble
'백준' 태그의 글 목록