알고리즘

[알고리즘] 백준 13410 - 거꾸로 구구단 (C++)

blueberrysoda 2024. 12. 28. 23:53

[문제 링크] : https://www.acmicpc.net/problem/13410

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int N, M, Ans = 0;
    cin >> N >> M;
    for(int i=1; i<=M; i++){
        int tmp = N * i;
        string S = to_string(tmp);
        reverse(S.begin(), S.end());
        int cnt = stoi(S);
        Ans = max(Ans, cnt);
    }

    cout << Ans << "\n";
    return 0;
}