璟雯院

珺璟如晔,雯华若锦

用户工具

站点工具


icpc:problems:luogup7257
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);
}
/app/www/public/data/pages/icpc/problems/luogup7257.txt · 最后更改: 2024/04/18 15:19 由 温婕莺