July 17th 模拟赛C T1 Gift Solution
来源:互联网 发布:万能摄像头软件下载 编辑:程序博客网 时间:2024/05/29 06:51
空降题目处(外网)
点我点我点我
空降题目处(内网)
点我点我点我
Description
无
(WHAT THE F**K)
Input
输入的第一行为一个整数t。
接下来t行,每行包含九个自然数。
Output
输出t行
每行一个整数,表示2a+2b+2c+2d+2e+2f+2g+2h+i 。
Solution
Some People Said That We Need High-Precision?!
有些人说要高精度?
Qword(Unsigned Long Long) Can Solve It,Just Need Pretreatment.
Qword(Unsigned Long Long)就能解决,只需要预处理(打表)。
Code
C++
#include<iostream>#include<cstdio>#include<cmath>using namespace std;unsigned long long x,y,m[61];int t;bool p;int main(){ m[0]=1LL; for (int i=1;i<=60;i++) m[i]=m[i-1]*2; scanf("%d",&t); for (int i=1;i<=t;i++) { x=0; p=true; for (int j=1;j<=8;j++) { scanf("%llu",&y); x+=m[y]; if (y!=60LL) p=false; } scanf("%llu",&y); if ((p)&&(y==9223372036854775808LL)) printf("18446744073709551616\n"); else printf("%llu\n",x+y); }}
Pascal
var x,y:qword; t,i,j:longint; p:boolean; m:array [0..60] of qword;begin m[0]:=1; for i:=1 to 60 do m[i]:=m[i-1]*2; readln(t); for i:=1 to t do begin x:=0; p:=true; for j:=1 to 8 do begin read(y); x:=x+m[y]; p:=(p) and (y=60); end; read(y); if (p) and (y=9223372036854775808) then writeln('18446744073709551616') else writeln(x+y); end;end.
0 0
- July 17th 模拟赛C T1 Gift Solution
- July 14th 模拟赛C T1 输油管道 Solution
- July 15th 模拟赛C T1 游泳池 Solution
- July 16th 模拟赛C T1 竞赛排名 Solution
- July 17th 模拟赛C T2 Number Solution
- July 17th 模拟赛C T3 Circle Solution
- September 17th 模拟赛C T1 铁轨 Solution
- July 14th 模拟赛C T2 数码问题 Solution
- July 14th 模拟赛C T3 灌水 Solution
- July 14th 模拟赛C T4 开花 Solution
- July 15th 模拟赛C T2 积木游戏 Solution
- July 16th 模拟赛C T3 圆周舞蹈 Solution
- July 16th 模拟赛C T4 奶牛排队 Solution
- June 11th 模拟赛C T1 Sandcas Solution
- September 10th 模拟赛C T1 电影票 Solution
- September 24th 模拟赛C T1 电费结算 Solution
- December 10th 模拟赛C T1 分发糖果 Solution
- July 15th 模拟赛C T3 最小最大和 Solution
- No.3拓扑排序和关键路径
- Convert Sorted Array to Binary Search Tree
- Sphinx
- BestCoder 2nd Anniversary
- Python - 数字类型
- July 17th 模拟赛C T1 Gift Solution
- JZOJ 4638 第三条跑道 【NOIP2016提高组A组7.16】
- [NOIP 2015]Day.1 T2 信息传递 【最小环】
- LintCode_401 Kth Smallest Number in Sorted Matrix
- cocos2D-x-新知识
- Java关键字
- NYOJ 组合数问题
- 初识ASP.NET Core 1.0
- 滑动视图和表示图的综合应用