티스토리 뷰

Algorithm/BOJ

백준 1075번 C++

poopooreum 2023. 7. 21. 15:34
반응형

https://www.acmicpc.net/problem/1075

1075번: 나누기

첫째 줄에 N, 둘째 줄에 F가 주어진다. N은 100보다 크거나 같고, 2,000,000,000보다 작거나 같은 자연수이다. F는 100보다 작거나 같은 자연수이다.

www.acmicpc.net


정답 코드

#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n,f;
    cin>>n>>f;
    int r=n%100;
    n=n-r;
    for(int i=0;i<100;i++)
    {
        if(n%f==0)break;
        n+=1;
    }
    int res=n%100;
    if(res/10==0)printf("0");
    printf("%d",res);
    return 0;
}


반응형

'Algorithm > BOJ' 카테고리의 다른 글

백준 1094번 C++  (0) 2023.07.21
백준 1085번 C++  (0) 2023.07.21
백준 1074번 C++  (0) 2023.07.21
백준 1065번 C++  (0) 2023.07.21
백준 1037번 C++  (0) 2023.07.20
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함