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. Elasticsearch技术解析与实战(三)文档的聚合

    1.计算每个tag下的商品数量 PUT /database/_mapping/product { "properties": { "tags": { " ...

  2. c++中引用的用法(转)

    from here 对于习惯使用C进行开发的朋友们,在看到c++中出现的&符号,可能会犯迷糊,因为在C语言中这个符号表示了取地址符,但是在C++中它却有着不同的用途,掌握C++的&符号 ...

  3. 【leetcode 简单】 第六十九题 删除链表中的节点

    请编写一个函数,使其可以删除某个链表中给定的(非末尾)节点,你将只被给定要求被删除的节点. 现有一个链表 -- head = [4,5,1,9],它可以表示为: 4 -> 5 -> 1 - ...

  4. 【leetcode 简单】 第五十七题 删除链表中的节点

    删除链表中等于给定值 val 的所有节点. 示例: 输入: 1->2->6->3->4->5->6, val = 6 输出: 1->2->3->4 ...

  5. VC++的全局变量(转)

    全局变量一般这样定义:1.在一类的.cpp中定义 int myInt;然后再在要用到的地方的.cpp里extern int myInt:这样就可以用了. 2.在stdafx.cpp中加入:int my ...

  6. Go语言的各种Print函数

    Go语言的各种Print函数 func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) func Pr ...

  7. raw数据类型

    Oracle中用于保存位串的数据类型是RAW,LONG RAW(推荐使用BLOB). RAW,类似于CHAR,声明方式RAW(L),L为长度,以字节为单位,作为数据库列最大2000,作为变量最大327 ...

  8. go 匿名函数和闭包

    匿名函数 1. 函数也是一种类型,因此可以定义作为一个函数类型的变量 package main import "fmt" // 函数作为参数 func add(a, b int) ...

  9. CentOS时区GMT修改为CST

    GMT:格林尼标准时间 北京时间=GMT时间+8小时 [root@sa~]# date -R 查看目前服务器的时间标准 [root@sa~]# vi /etc/sysconfig/clock 将ZON ...

  10. docker stack 部署 mysql 5.6

    =============================================== 2018/7/1_第1次修改                       ccb_warlock === ...