目录

problems
名称FILIP
题目编号P7257
题目链接luogu.com.cn/…
来源Luogu
算法分类入门_循环
难易程度入门

FILIP

想法

使用while进行拆分。

代码实现

函数实现:可以训练函数基础应用

#include <algorithm>
#include <cstdio>
using namespace std;
 
int s(int x) {
    int ans = 0;
    while (x) {
        ans = ans * 10 + x % 10;
        x /= 10;
    }
    return ans;
}
 
int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    int mx = max(s(a), s(b));
    printf("%d", mx);
}