Saturday, January 10, 2009

UVA problem 10633: sample code


001 #include "stdio.h"
002 #include "iostream"
003
004 using namespace std;
005
006 int main() {
007 char line[100];
008 unsigned long long
009 x
010 , y
011 , z
012 , m
013 , n
014 ;
015
016 while (1) {
017 cin >> y;
018
019 if (y == 0) {
020 break;
021 }
022
023 x = y / 9;
024 n = y + x;
025
026 z = x * 9;
027 if (z == y) {
028 m = n - 1;
029 cout << m << " ";
030 }
031
032 cout << n << endl;
033 }
034
035 return 0;
036 }

No comments:

Post a Comment