코딩테스트/프로그래머스 - LV 1
[프로그래머스] 나머지가 1이 되는 수 찾기
웅드
2024. 2. 9. 16:55
- 풀이
#include <string>
#include <vector>
using namespace std;
int solution(int n) {
int answer = 0;
while(1){
answer++;
if(n % answer ==1){break;}
}
return answer;
}
반응형