[BOJ 1075] 나누기

Leehyemin·2023년 3월 12일
0

알고리즘_백준

목록 보기
3/7
#include <iostream>
using namespace std;
//1075 나누기 
// Created by polcomicepute

int main(){
    int N=0, F=0, remainder =0, correct_n =0 , n=0;
    cin >> N;
    cin >> F;

    n = (int(N/100)*100); // ~00 (최소) ~99(최대)
    remainder =  (F-(n%F))% F; // 최소값일때 갖는 나머지 
    correct_n = n + remainder; // 나머지를 최소값에 더해줘서 나누어 떨어지도록 

    cout << (correct_n/10)%10 << correct_n%10 << endl; //10의자리 , 1의자리 출력

    return 0;
}

0개의 댓글