DAY 1 완료한 작업 1) 플레이어 생성 2) 다수의 적 생성 / 위치 랜덤으로시작 3)플레이어 키보드로 조작 기능
Roble
게임명 : Dribble The Spaceship 개발 환경 : windows10 / visual studio 2022 / SFML 사용언어 : C++ 게임 내용 : 우주선을 조작해서 따라오는 적 우주선으로부터 도망간다. 일정 간격마다 조작하는 우주선에서 미사일이 제일 근접한 적 우주선을 격침시킨다. 적 우주선과 충돌하면 게임이 끝난다. 특정 버튼을 눌러 다시 시작한다.
보호되어 있는 글입니다.
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