Codeforces Round #633 (Div. 2) A Filling Diamonds (假题,观察)
Filling Diamonds
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
You have integer nn. Calculate how many ways are there to fully cover belt-like area of 4n−24n−2 triangles with diamond shapes.
Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it.
22 coverings are different if some 22 triangles are covered by the same diamond shape in one of them and by different diamond shapes in the other one.
Please look at pictures below for better understanding.
On the left you can see the diamond shape you will use, and on the right you can see the area you want to fill.
These are the figures of the area you want to fill for n=1,2,3,4n=1,2,3,4.
You have to answer tt independent test cases.
Input
The first line contains a single integer tt (1≤t≤1041≤t≤104) — the number of test cases.
Each of the next tt lines contains a single integer nn (1≤n≤1091≤n≤109).
Output
For each test case, print the number of ways to fully cover belt-like area of 4n−24n−2 triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed 10181018.
Example
input
2
2
1
output
2
1
Note
In the first test case, there are the following 22 ways to fill the area:
In the second test case, there is a unique way to fill the area:
思路:冷静下来,这是div2A题而已,一定是找规律的假题,我们观察到每一种新的方法唯一的不同之处就是竖放的菱形,就是n=1的那个图形,而n有n个不同位置的竖菱形,答案就是n
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rg register ll
#define inf 2147483647
#define lb(x) (x&(-x))
ll sz[200005],n;
template <typename T> inline void read(T& x)
{
x=0;char ch=getchar();ll f=1;
while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}x*=f;
}
inline ll query(ll x){ll res=0;while(x){res+=sz[x];x-=lb(x);}return res;}
inline void add(ll x,ll val){while(x<=n){sz[x]+=val;x+=lb(x);}}//第x个加上val
ll t;
int main()
{
cin>>t;
for(int i=1;i<=t;i++)
{
ll x;
cin>>x;
cout<<x<<endl;
}
return 0;
}
- Basic Calculator 基本计算器-Leetcode
- python yield函数深入浅出理解
- 十分钟搞定 Tensorflow 服务
- datapump跨平台升级迁移的总结 (r8笔记第77天)
- Java中isAssignableFrom()方法与instanceof()方法用法
- 与Ajax同样重要的jQuery(1)
- Java中Class类详解、用法及泛化
- python 函数编程的位置参数、默认参数、关键字参数以及函数的递归
- Java子类的父类和要实现的接口有相同的方法/函数会冲突吗
- Java关键字 Finally执行与break, continue, return等关键字的关系
- #if 和#ifdef的区别
- python高阶函数:map(f,[list]),reduce(f,[list],可选初始值),
- 深入探讨 Java 类加载器
- 斐波那契查找原理详解与实现
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- 浅析PHP7 的垃圾回收机制
- android BottomSheetDialog新控件解析实现知乎评论列表效果(实例代码)
- Laravel框架实现的上传图片到七牛功能详解
- Flutter沉浸式状态栏/AppBar导航栏/仿咸鱼底部凸起导航栏效果
- Android集成zxing扫码框架功能
- Android 实现抖音小游戏潜艇大挑战的思路详解
- 修改Android Studio 的 Logcat 缓冲区大小操作
- Android自定义View验证码输入框
- PHP生成随机字符串实例代码(字母+数字)
- Laravel框架中缓存的使用方法分析
- android实现搜索功能并将搜索结果保存到SQLite中(实例代码)
- Android实现全局右滑返回
- Android实现打地鼠小游戏
- android实现手机传感器调用
- Android实现接近传感器