Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <stdio.h>
- #include <algorithm>
- #include <cstring>
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cctype>
- #include <stack>
- #include <queue>
- #include <list>
- #include <vector>
- #include <map>
- #include <set>
- #include <sstream>
- #include <stdlib.h>
- #include <cmath>
- #define LL unsigned long long
- using namespace std;
- int main()
- {
- long long n,a,s,c;
- int t,i;
- while(scanf("%d",&t)==1)
- {
- for(i=1;i<=t;i++)
- {
- scanf("%lld",&n);
- a=n;
- c=0;
- while(1)
- {
- s=0;
- while(n!=0)
- {
- s=s*10+n%10;
- n/=10;
- }
- if(s==a)
- break;
- else
- {
- n=s+a;
- a=s+a;
- c++;
- }
- }
- printf("%lld %lld\n",c,a);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement