HDU4706——Children's Day(简单模拟)
2015-05-08 21:28
288 查看
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=4706
解题思路:
直接模拟就好了。。。
简单的水题。可是我模拟太烂了,没办法,比赛时,为了题数,只好暴力求解了...
AC代码:
另附两大牛AC代码:
http://acm.hdu.edu.cn/showproblem.php?pid=4706
解题思路:
直接模拟就好了。。。
简单的水题。可是我模拟太烂了,没办法,比赛时,为了题数,只好暴力求解了...
AC代码:
#include<iostream> #include<cstdio> using namespace std; int main() { printf("a e\n"); printf("bdf\n"); printf("c g\n"); printf("h n\n"); printf("i mo\n"); printf("jl p\n"); printf("k q\n"); printf("r z\n"); printf("s ya\n"); printf("t x b\n"); printf("uw c\n"); printf("v d\n"); printf("e o\n"); printf("f np\n"); printf("g m q\n"); printf("h l r\n"); printf("ik s\n"); printf("j t\n"); printf("u g\n"); printf("v fh\n"); printf("w e i\n"); printf("x d j\n"); printf("y c k\n"); printf("zb l\n"); printf("a m\n"); printf("n b\n"); printf("o ac\n"); printf("p z d\n"); printf("q y e\n"); printf("r x f\n"); printf("s w g\n"); printf("tv h\n"); printf("u i\n"); printf("j z\n"); printf("k ya\n"); printf("l x b\n"); printf("m w c\n"); printf("n v d\n"); printf("o u e\n"); printf("p t f\n"); printf("qs g\n"); printf("r h\n"); printf("i a\n"); printf("j zb\n"); printf("k y c\n"); printf("l x d\n"); printf("m w e\n"); printf("n v f\n"); printf("o u g\n"); printf("p t h\n"); printf("qs i\n"); printf("r j\n"); return 0; }
另附两大牛AC代码:
#include <iostream> #include <cstdio> using namespace std; char str[100][100]; int main(){ int cnt = 0; for(int i = 3;i <= 10;i++){ for(int j = 0;j < i;j++){ for(int k = 0;k < i;k++) str[j][k] = ' '; str[j][i] = 0; } for(int j = 0;j < i;j++){ str[j][0] = 'a' + cnt; cnt = (cnt+1)%26; } for(int j = i-2;j > 0;j--){ str[j][i-1-j] = 'a' + cnt; cnt = (cnt+1)%26; } for(int j = 0;j < i;j++){ str[j][i-1] = 'a' + cnt; cnt = (cnt+1)%26; } for(int j = 0;j < i;j++) printf("%s\n",str[j]); } return 0; }
#include <stdio.h> const int N = 26; int solve(int n, int c){ int dist = 2 * (n - 1); for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ if (j == 0) printf("%c", 'a' + (c + i) % N); else if(j == n - 1) printf("%c", 'a' + (c + i + dist) % N); else if(i + j == n - 1) printf("%c", 'a' + (i + c + (n - i - 1) * 2) % N); else printf(" "); } printf("\n"); } } int main(){ int t = 0; for (int i = 3; i <= 10; i++){ solve(i, t); t += i * 3 - 2; } return 0; }
相关文章推荐
- HDU 4706 Children's Day(模拟)
- HDU-#4706 Children's Day(模拟)
- HDU 4706 Children's Day(模拟啊)
- hdu 4706 (是暴力?还是愚蠢?)Children's Day
- hdu 4706 Children's Day
- hdu 4706 Children's Day 2013年ICPC热身赛A题 模拟
- HDU-5186-zhx's submissions(Java+简单模拟)
- HDU 4706 Children's Day(简单模拟)
- (hdu step 8.1.6)士兵队列训练问题(数据结构,简单模拟——第一次每2个去掉1个,第二次每3个去掉1个.知道队伍中的人数<=3,输出剩下的人 )
- HDU1037 - Keep on Truckin' (简单题)
- hdu 1160 FatMouse's Speed 简单dp 题解
- HDU 4706 Children's Day(模拟)
- POJ 1573 && hdu 1035(简单模拟)
- hdu 1160 FatMouse's Speed 题解(简单dp)
- [简单博弈] hdu 1525 Euclid's Game
- POJ 1573 && hdu 1035 Robot Motion【简单模拟】
- hdu 4706 Children's Day 2013年ICPC热身赛A题 模拟
- hdu 4119 Isabella's Message(模拟+字典树)
- POJ 1573 && hdu 1035 Robot Motion(简单模拟)
- HDU 4119 Isabella's Message(模拟)