Description

In the planet Pandora, Jake found an old encryption algorithm. The plaintext, key and ciphertext are all four decimal numbers and all greater than 0. The way to get the ciphertext from the plaintext and the key is very simple: the ciphertext is the last four digits of the product of the plaintext and the key (for example: the plaintext is 2010 and the key is 4024, and then the product is 8088240. So the ciphertext is 8240).

Note that the plaintext and the key don’t have leading 0, while the ciphertext might have. Now given the plaintext and the key, you are asked to figure out the ciphertext for Jake quickly.

Input

The first line is an integer T, which presents the number of test cases. Then there are T lines, each line has two integers, the first integer is the plaintext and the second is the key.

Output

For each test case, output the ciphertext.

Sample Input

2
2010 4024
1234 1111

Sample Output

8240
0974

Hint


两数相乘,取模10000就可以了
#include<stdio.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
typedef long long ll;
using namespace std;
ll x, y;
int main()
{
int t;
while (~scanf("%d", &t))
{
while (t--)
{
scanf("%lld%lld", &x, &y);
ll num = x*y;
num = num % 10000;
printf("%.4lld\n", num);
}
}
return 0;
}
/**********************************************************************
Problem: 1018
User: leo6033
Language: C++
Result: AC
Time:0 ms
Memory:2024 kb
**********************************************************************/

CSUOJ 1018 Avatar的更多相关文章

  1. CSU1018: Avatar

    1018: Avatar Submit Page   Summary   Time Limit: 1 Sec     Memory Limit: 128 Mb     Submitted: 841   ...

  2. PAT A 1018. Public Bike Management (30)【最短路径】

    https://www.patest.cn/contests/pat-a-practise/1018 先用Dijkstra算出最短路,然后二分答案来验证,顺便求出剩余最小,然后再从终点dfs回去求出路 ...

  3. u3d avatar部件的理解

    u3d中带动画的fbx文件导入的时候,就会显示一个avatar组件,这个到底干嘛的一直没能很好的理解,翻看网上的介绍,基本都是告诉你,设置humanoid类型动画时,拖拉过去之类,但是这玩意到底存储了 ...

  4. csuoj 1511: 残缺的棋盘

    http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1511 1511: 残缺的棋盘 时间限制: 1 Sec  内存限制: 128 MB 题目描述 输入 ...

  5. ERROR 1018 (HY000): Can't read dir of './test/' (errno: 13)

    不能查看mysql中数据库的表. 一.查看 mysql> desc test; ERROR 1046 (3D000): No database selected mysql> use te ...

  6. (状压) Brush (IV) (Light OJ 1018)

    http://www.lightoj.com/volume_showproblem.php?problem=1018   Mubashwir returned home from the contes ...

  7. HDU 1018 Big Number (数学题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1018 解题报告:输入一个n,求n!有多少位. 首先任意一个数 x 的位数 = (int)log10(x ...

  8. Ural 1018 (树形DP+背包+优化)

    题目链接: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=17662 题目大意:树枝上间连接着一坨坨苹果(不要在意'坨'),给 ...

  9. 【BZOJ】1018: [SHOI2008]堵塞的交通traffic

    http://www.lydsy.com/JudgeOnline/problem.php?id=1018 题意:有2行,每行有c(c<=100000)个城市,则一共有c-1个格子,现在有q(q& ...

随机推荐

  1. Java并发编程原理与实战二十三:Condition原理分析

    先来回顾一下java中的等待/通知机制 我们有时会遇到这样的场景:线程A执行到某个点的时候,因为某个条件condition不满足,需要线程A暂停:等到线程B修改了条件condition,使condit ...

  2. 由简单的CMD命令引发的一场学习战斗

    想要打开一个软件时,由于桌面没有存放快捷方式,又忘了软件存放在电脑上的哪个角落.脑海里突然闪过一个想法:用CMD自定义软件的打开方式,于是问了度娘.由此,引发了一场停不下来的CMD学习战斗. 爱上CM ...

  3. c++刷题(15/100)矩阵转置,最深子树

    题目一:矩阵转置 给定一个矩阵 A, 返回 A 的转置矩阵. 矩阵的转置是指将矩阵的主对角线翻转,交换矩阵的行索引与列索引. 示例 1: 输入:[[1,2,3],[4,5,6],[7,8,9]] 输出 ...

  4. Unity 3(二):Unity在AOP方面的应用

    本文关注以下方面(环境为VS2012..Net Framework 4.5以及Unity 3): AOP简介: Interception using Unity示例 配置文件示例 一.AOP简介 AO ...

  5. local variables referenced from a Lambda expression must be final or effectively final------理解

    前几天使用lamdba时,报了一个这个错,原因是在lamdba体中使用了一个变量,觉得很奇怪! 今天在读这本书的时候,又看到了这个解释,这里有了更深刻的理解,总结一下: 在jdk1.8之前在使用匿名内 ...

  6. 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)[转]

    最近有一些朋友常问我一些乱码的问题,和他们交流过程中,发现这个编码的相关知识还真是杂乱不堪,不少人对一些知识理解似乎也有些偏差,网上百度, google的内容,也有不少以讹传讹,根本就是错误的(例如说 ...

  7. Mysql中truncate table和delete语句的区别

    Mysql中的truncate table和delete语句都可以删除表里面所有数据,但是在一些情况下有些不同! 例子: truncate table gag; (1)truncate table删除 ...

  8. linux用户权限 -> 系统基本权限

    比如rwxr-xr-x linux中正是这9个权限位来控制文件属主(User).属组(Group).其他用户(Other)基础权限. 用户对资源来说, 有三种角色 User(u): 属主用户(文件所有 ...

  9. 数据库-mysql数据库和表操作

    一:数据库查询增加删除 1)mysql数据库查询:show databases MariaDB [mysql]> show databases; +--------------------+ | ...

  10. python基础--json,pickle和shelve模块

    一.JSON &pickle 用于序列化的两个模块 json,用于字符串 和 python数据类型间进行转换  字符串必须是双引号,不能是单引号 pickle,用于python特有的类型 和 ...