hd acm1061
Each test case contains a single positive integer N(1<=N<=1,000,000,000).
In the first case, 3 * 3 * 3 = 27, so the rightmost digit is 7.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num1[4]={0,1,5,6};
int num2[4][4]={{4,8,6,2},{9,7,1,3},
{9,3,1,7},{4,2,6,8}};
int num3[2][2]={{6,4},{1,9}};
int n,i,rea,j;
long x,y;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%ld",&x);
rea=x%10;
for(j=0;j<4;j++){
if(num1[j]==rea){
printf("%d\n",num1[j]);
rea=0;
break;
}
}
if(rea){
if(rea==2){
y=(x-1)%4-1;
printf("%d\n",num2[0][y]);
}
if(rea==3){
if((x-1)%4==0) y=3;
else y=(x-1)%4-1;
printf("%d\n",num2[1][y]);
}
if(rea==7){
if((x-1)%4==0) y=3;
else y=(x-1)%4-1;
printf("%d\n",num2[2][y]);
}
if(rea==8){
y=(x-1)%4-1;
printf("%d\n",num2[3][y]);
}
if(rea==4){
y=(x-1)%2-1;;
printf("%d\n",num3[0][y]);
}
if(rea==9){
if((x-1)%2==0) y=1;
else y=(x-1)%2-1;
printf("%d\n",num3[1][y]);
}
}
}
return 0;
}
hd acm1061的更多相关文章
- ATI Radeon HD 5450 with full QE/CI Support ( 转载 )
ATI Radeon HD 5450 with full QE/CI Support - DSDT (Contains HDMI Audio Edit Too) & AGPM included ...
- XPS 15 9530使用Windows10频繁发生Intel HD Graphics 4600驱动奔溃的一种解决方法
本人使用XPS 15 9530.集成显卡为Intel HD Graphics 4600.操作系统Windows 10 Pro,使用过程当中经常会发生集成显卡奔溃的问题,错误提示如下: Display ...
- Radeon HD 7850 vs Radeon R9 270X
Radeon HD 7850 vs Radeon R9 270X HW compare Intro The Radeon HD 7850 comes with a GPU core speed ...
- 电影TS、TC、SCR、R5、BD、HD等版本是什么意思
在很多电影下载网站的影片标题中我们都能看到,比如<刺杀希特勒BD版>.<游龙戏凤TS版>等,这些英文缩写都是什么意思呢?都代表什么画质?以下就是各个版本的具体含义: 1.CAM ...
- stm32类型cl、vl、xl、ld、md、hd的含义
- startup_stm32f10x_ld_vl.s: for STM32 Low density Value line devices - startup_stm32f10x_ld.s: for ...
- 瑞昱Realtek(Realtek HD Audio Driver)音频声卡驱动R2.49 for Win7_Vista
不管是在高端系列主板上,还是在低端系列主板上,我们都能看到Realtek瑞昱的身影,Realtek HD Audio Driver能够支持所有的Realtek HD Audio音频驱动.Realtek ...
- cocos2d-x 2.0.3 设置高清模式注意事项(已移除-hd方式)
猴子原创,欢迎转载.转载请注明: 转载自Cocos2D开发网–Cocos2Dev.com,谢谢! 原文地址: http://www.cocos2dev.com/?p=304 在cocos2d-x 2. ...
- %hd %d %ld %u ......
%d 有符号10进制整数 %ld 长整型 %hd短整型%md,m指定的是输出字段的宽度,默认左补空格, 如果数据的位数小于m,则左端补以空格,若大于m,则 按实际位数输出,如: printf(&quo ...
- 求刷Kindle Fire HD的方法
前几天入手了台Amazon Kindle Fire HD 其系统是经过Amazon尝试改造过的Android,用起来很不爽,想刷个CM10之类的,求教程和工具.
随机推荐
- 遍历list,字典
private void Form1_Load(object sender, EventArgs e) { List<int> ids = new List<int>(); i ...
- nightwatch-js -- test group
Test group 可以将你的测试脚本划分到组中,并根据需要运行它们.要将测试组合在一起,只需将它们放在相同的子文件夹中,文件夹的名字即是组的名字.例如:lib/├── selenium-serve ...
- Proftp设置虚拟用户(转)
首先在proftpd.conf中添加: AuthOrder mod_auth_file.c mod_auth_unix.c AuthUserFile /usr/local/etc/ftp ...
- Ubuntu 16.04 安装opencv的各种方法(含opencv contrib扩展包安装方法)
Ubuntu 16.04 安装opencv的各种方法(含opencv contrib扩展包安装方法) https://blog.csdn.net/ksws0292756/article/details ...
- Java中HashTable和HashMap的区别
在Java中,HashTable和HashMap都是哈希表,那么它们有什么区别呢? 1.它们所继承的类不一样. HashTable和HashMap都实现了Map接口,但是它们所继承的类时不同的.H ...
- oracle复合索引的选择和使用
声明:虽然题目是Oracle.但同样适合MySQL InnoDB索引 在大多数情况下.复合索引比单字段索引好 很多系统就是靠新建一些合适的复合索引.使效率大幅度提高 ...
- Python环境搭建及IDE选择(转载)
Python环境搭建及IDE选择 人工智能社区 http://studyai.com 系统:Windows 7 版本:Python 2.7 一.安装Python 在开始编程之前,我们首先需要搭建Pyt ...
- php7.0 出现 curl_setopt(): Disabling safe uploads is no longer supported in 报错!
项目换成php7.0,进行了测试,使用curl时,出现: curl_setopt(): Disabling safe uploads is no longer supported in xxx.定位到 ...
- vs2013中opencv的配置
下面开始介绍如何配置,我用的系统是win8.1 64位系统,vs用的是vs3013 ultimate,先到官网下载opencv 我用的的版本是最新的版本3.0 ALPHA,下载下来直接执行即可,实际上 ...
- erlang 最大公约数
一般面试会遇到问一些算法,什么排序,树,图等等,冷不丁还会问几个蛋疼的问题,我估计生产情况十有八九都用不上,只是题目罢了. 题目:求两个大数的最大公约数. 什么是最大公约数呢? 百度百科的答案这样的: ...