HDUOJ Children’s Queue
Children’s Queue
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 8835 Accepted Submission(s): 2813
FFFF, FFFM, MFFF, FFMM, MFFM, MMFF, MMMM
Here F stands for a girl and M stands for a boy. The total number of queue satisfied the headmaster’s needs is 7. Can you make a program to find the total number of queue with n children?
#include<iostream>
#include<cstdio>
#define maxn 250
#define len 1000
using namespace std;
int a[len+][maxn+]={{},{},{},{}};
int main()
{
int i,j,n,s,c=;
for(i=;i<=len;i++)
{
for(c=j=;j<=maxn;j++)
{
s=a[i-][j]+a[i-][j]+a[i-][j]+c;
a[i][j]=s%;
c=(s-a[i][j])/;
}
}
while(cin>>n)
{
for(i=maxn;a[n-][i]==;i--);
for(j=i;j>=;j--)
{
printf("%d",a[n-][j]);
}
printf("\n");
}
return ;
}
HDUOJ Children’s Queue的更多相关文章
- HDU1297 Children’s Queue (高精度+递推)
Children’s Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- 【高精度递推】【HDU1297】Children’s Queue
Children's Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- Children’s Queue
Children's Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- Children’s Queue(hdu1297+递推)
Children’s Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- (递推 大整数) Children’s Queue hdu1297
Children’s Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDOJ 1297 Children’s Queue
版权声明:来自: 码代码的猿猿的AC之路 http://blog.csdn.net/ck_boss https://blog.csdn.net/u012797220/article/details/3 ...
- HDU 1297 Children’s Queue (递推、大数相加)
Children’s Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDOJ/HDU 1297 Children’s Queue(推导~大数)
Problem Description There are many students in PHT School. One day, the headmaster whose name is Pig ...
- Children’s Queue HDU 1297 递推+大数
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1297 题目大意: 有n个同学, 站成一排, 要求 女生最少是两个站在一起, 问有多少种排列方式. 题 ...
随机推荐
- LeetCode: Implement strStr() [027]
[题目] Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if ...
- VS2010+OpenCV2.4.3配置
VS2010+OpenCV2.4.3配置: 环境变量path: D:\openCV2.4.3\opencv\build\x86\vc10\bin 项目-属性-VC++目录:(vs2008中,工具- ...
- hdu 4548 美素数 超级大水题
美素数 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submis ...
- Merge Interval leetcode java
题目: Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6] ...
- mybatis 针对SQL Server 的 主键id生成策略
SQL Server中命令: select newId() ,可以得到SQL server数据库原生的UUID值,因此我们可以将这条指令写到 Mybatis的主键生成策略配置selectKey中. ...
- android 创建通知栏Notification
///// 第一步:获取NotificationManager NotificationManager nm = (NotificationManager) getSystemService(Cont ...
- magento upsell from cur_category
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Academic Free Li ...
- 输入框提示文字跨浏览器的placeholder-jQuery版
<script type="text/javascript" src="jquery-1.7.2.min.js"></script> & ...
- 【Node.js】初体验之安装和HelloWorld
听说Node.js是个蛮吊的东东.中午休息时间有限,暂时看了下知道怎么安装和初步使用了. 1.安装: 到Node.js官网下载就可以了,才5M多点,双击后按步骤安装就可以了. 2."Hell ...
- Linux History安全问题【保存记录防止删除】+完善Linux/UNIX审计 将每个shell命令记入日志
2011-09-27 22:11:51| 分类: rhel5_033|举报|字号 订阅 Linux利用PROMPT_COMMAND实现审计功能 这个系统审计,记录什么用户,在什么时间,做 ...