NEFU 696 Dart game 背包dp
来源:互联网 发布:linux如何修改主机名 编辑:程序博客网 时间:2024/06/08 05:09
Dart game
Time Limit 1000ms
Memory Limit 65536K
description
Darts originated in Australia. Australia's aborigines initially for hunting and hit the enemy's weapon. A game of darts in which the players attempt to score points by throwing the darts at a target.Figure:DART BOARD Darts movement rules of the game is very simple, the target is 1-20 points and the central circle is 50 small zoning, edge is 25 division, the rough circle line of fan-shaped covered area is 1-20 points and three times the corresponding division. This game is generally played by two people but can be played by teams. Each player starts with N points. The goal for each player is to reach zero by subtracting the amount they score from the amount they had left,but final throwing must be double division. And the first to reduce his/her score to zero wins. So the task is : Given a dart scores N that a player starts with, you are required to calculate how many different ways to reach zero. One is different way to another means at least one dart hits different division.Ways which have different orders and same divisions are the same way. For example,if N=4,there are 4 different ways reach to zero:the first is double 2,the second is 2 and double 1, the third is twice of double 1,the fourth is twice of 1 and double 1 . The answer may be very large,you have to module it by 2011.
input
The input contains several test cases. Each test case contains an integer N ( 0 < N ≤ 1001 ) in a line. N=0 means end of input and need not to process.
output
For each test case, output how many different ways to reach zero.
sample_input
543210
sample_output
64110
-----------------------------------至少含有一种double的取法数=总的取法-不含有double的取法。
多水的题啊!!!!数据有误!!!有误!!啊!
---------------------------------
#include <iostream>#include <cstdio>#include <cstring>using namespace std;int a[111]= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,25, //21 3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60, //41 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,50};//62int f[1111];int g[1111];int n;int main(){ memset(f,0,sizeof(f)); memset(g,0,sizeof(g)); f[0]=1; for (int i=0; i<62; i++) { for (int j=0; j<=1001-a[i]; j++) { if (f[j]) { f[j+a[i]]=(f[j+a[i]]+f[j])%2011; } } } //for (int i=0;i<100;i++) printf("%d ",f[i]); g[0]=1; for (int i=0; i<41; i++) { for (int j=0; j<=1001-a[i]; j++) { if (g[j]) { g[j+a[i]]=(g[j+a[i]]+g[j])%2011; } } } while (~scanf("%d",&n)) { if (n==0) break; printf("%d\n",(f[n]-g[n]+2011)%2011); } return 0;}
- NEFU 696 Dart game 背包dp
- nefu696 Dart game(dp背包)
- UESTC 929 Dart game 完全背包
- UESTC 927 Dart game【思维+Dp】
- NEFU English Game 字符串 dp 字典树
- Dart game UESTC
- ZOJ 2955 Interesting Dart Game(完全背包+鸽巢原理)
- NEFU 1028 01背包
- NEFU 655 图dp
- Dp 入门 ( nefu 17 nefu 20 )
- NEFU 711 Take Pebble Game
- NEFU 655 Trip(DP)
- NEFU 642 Monkey(DP)
- NEFU 700 Car race game 树状数组
- ZOJ2955 Interesting Dart Game 鸽巢原理优化 + 动规
- NEFU 155 超弦(插头DP)
- NEFU 641 素数树(树形DP)
- NEFU 642 monkey(DP+优化)
- dmesg | grep word_count
- 享元模式
- List和ArrayList的区别
- awk 程序中使用 Shell 命令
- CF:71A.Way Too Long Words
- NEFU 696 Dart game 背包dp
- shell语法case
- Qt embedded的测试
- Sailfish应用开发入门(六)DatePicker和DatePickerDialog
- 获取IOS应用安装列表
- Linux下使用无线网卡搭建AP
- NEFU 697 Similar Word KMP
- 各种应用访问jboss5.0管理数据源方式
- C++ 常量指针或者常量引用作为函数参数传递的原因