洛谷 P1307 数字反转

来源:互联网 发布:域名rp怎么提高 编辑:程序博客网 时间:2024/06/06 00:11

其中的核心语句
是一个很好的 用于数字翻转的模板

//P1307 数字反转//2016.11.26#include <iostream>#include <cstdio>using namespace std;int n, m;int main(){    scanf("%d", &n);    while (n != 0){        m = m * 10 + n % 10;        n = n / 10;    }    cout << m;    return 0;}
0 0
原创粉丝点击