猜数游戏

 

 

题目描述

有一个“就是它”的猜数游戏,步骤如下:请你对任意输入的一个三位数x,在这三位数后重复一遍,得到一个六位数,467-->467467.把这个数连续除以7、11、13,输出最后的商。
 

输入

输入一个三位数x。

输出

输出最后的商。
 

样例输入

100

样例输出

100
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s = to_string(n);   //数字--字符串
    string temp = s+s;
    cout<<temp<<endl;
    
    int ans = stoi(temp);    //字符串--数字
    cout<<ans<<endl;
    
    int res = ans/7/11/13;
    cout<<res;
    
    return 0;
}

 

posted @ 2018-11-07 11:56  道微真理  阅读(970)  评论(0编辑  收藏  举报