// UVa 256 - Quirksome Squares #include <iostream> #include <stdio.h> #include <string> using namespace std; #define datatype unsigned long long datatype ten[9] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 }; #define twos 3 #define fours 5 #define sixes 5 #define eights 9 string two[twos] = { "00", "01", "81" }; string four[fours] = { "0000", "0001", "2025", "3025", "9801" }; string six[sixes] = { "000000", "000001", "088209", "494209", "998001" }; string eight[eights] = { "00000000", "00000001", "04941729", "07441984", "24502500", "25502500", "52881984", "60481729", "99980001" }; int main() { int n; while (cin >> n) { switch (n) { case 2: for (int i = 0; i < twos; i++) cout << two[i] << endl; break; case 4: for (int i = 0; i < fours; i++) cout << four[i] << endl; break; case 6: for (int i = 0; i < sixes; i++) cout << six[i] << endl; break; case 8: for (int i = 0; i < eights; i++) cout << eight[i] << endl; break; } } return 0; }
Sunday, June 7, 2015
UVa 256 - Quirksome Squares
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment