2013 ACM/ICPC Asia Regional Online —— Warmup - Gemini Boy - ACM之路~
2013 ACM/ICPC Asia Regional Online —— Warmup
A题(HDU 4706):无意义的题,就贴个代码吧
#include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <iostream> using namespace std; void get(int x, int n) { int y = x + 2 * (n - 1); y %= 26; for (int i = 1; i <= n; i++) { printf("%c", 'a'+(x+i-1)%26); for (int j = n-i-1; j >= 1; j--) printf(" "); if (i > 1 && i < n) printf("%c", 'a'+(y+1-i+26)%26); for (int j = 1; j <= i-2; j++) printf(" "); printf("%c\n", 'a'+(y+i-1)%26); } } int main() { int x = 0; for (int i = 3; i <= 10; i++) { get(x, i); x = (x+2*i+i-2) % 26; } return 0; }