HDU4706——Children's Day(简单模拟)
来源:互联网 发布:歼十外销知乎 编辑:程序博客网 时间:2024/06/06 15:35
题目链接:
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;}
0 0
- HDU4706——Children's Day(简单模拟)
- ACM-简单题之Children's Day——hdu4706
- HDU4706:Children's Day
- HDU4706-Children's Day
- HDU4706 Children's Day
- HDU-#4706 Children's Day(模拟)
- 4706 Children's Day 模拟
- Children's Day——打印N(HDU)
- HDU 4706 Children's Day(模拟啊)
- HDU 4706 Children's Day(模拟)
- Children's Day(4706)
- Children's Day
- Rainy Children's Day
- Children's Day
- Children's Day
- hdu 4706 Children's Day 模拟打印N
- hdu4706!【模拟】
- hdu 4706 Children's Day
- Hadoop MapReduce
- UVA 1638(动态规划)
- Ie中的404错误
- Redis源码阅读之aof.c
- 【c语言】关于+1的各种情况
- HDU4706——Children's Day(简单模拟)
- 细说UI线程和Windows消息队列
- 位逆置变换
- 获取字符串中每个字母出现的次数
- Implement Trie (Prefix Tree)
- 二分查找法--while语句实现
- KMP
- linux下安装flashplayer
- 响应式布局的三大要点