A. Cookies
来源:互联网 发布:联通网络id 编辑:程序博客网 时间:2024/06/07 01:38
Fangy collects cookies. Once he decided to take a box and put cookies into it in some way. If we take a square k × k in size, divided into blocks 1 × 1 in size and paint there the main diagonal together with cells, which lie above it, then the painted area will be equal to the area occupied by one cookie k in size. Fangy also has a box with a square base 2n × 2n, divided into blocks 1 × 1 in size. In a box the cookies should not overlap, and they should not be turned over or rotated. See cookies of sizes 2 and 4 respectively on the figure:
To stack the cookies the little walrus uses the following algorithm. He takes out of the repository the largest cookie which can fit in some place in the box and puts it there. Everything could be perfect but alas, in the repository the little walrus has infinitely many cookies of size 2 and larger, and there are no cookies of size 1, therefore, empty cells will remain in the box. Fangy wants to know how many empty cells will be left in the end.
The first line contains a single integer n (0 ≤ n ≤ 1000).
Print the single number, equal to the number of empty cells in the box. The answer should be printed modulo 106 + 3.
3
9
If the box possesses the base of 23 × 23 (as in the example), then the cookies will be put there in the following manner:
#include <cstdio>#include <cmath>#include <algorithm>int main(){ int a; long long x[1002]; x[0]=1; x[1]=1;x[2]=3; for (int number1=3;number1<1002;number1++) { x[number1]=x[number1-1]*3%(1000000+3); } while(scanf("%d",&a)!=EOF) { printf("%d\n",x[a]); } return 0;}
- A. Cookies
- A. Cookies
- A. Cookies
- A Cgi Set Cookies
- A Cgi Get Cookies
- CodeForces 70A Cookies
- 【找规律】#64 A. Cookies
- CodeForces NO.70A Cookies
- Codeforces Gym 100340A Cookies
- Codeforces GYM 100340A Cookies
- jQuery & Cookies (get/set/delete & a plugin)
- Codeforces 129A-Cookies(暴力)
- cookies
- Cookies
- Cookies
- Cookies
- Cookies
- Cookies
- 如何将linux一个程序作为一个服务
- 跟我学数据结构之栈和队列
- android:launchMode
- C#反射的运用
- 【SPOJ-WACHOVIA】Wachovia Bank【01背包】
- A. Cookies
- 骑士周游问题(暴力解决:回溯法)
- Android java.lang.NoClassDefFoundError的一种解决方法
- aerospike实战之put操作
- 倒计时(团购)
- Union All/Union/Intersect操作
- 使用 WebSockets 进行 HTML5 视频直播
- 歌曲歌词下载接口
- C++基础