博客
关于我
CSUOJ 1018 Avatar
阅读量:428 次
发布时间:2019-03-06

本文共 1477 字,大约阅读时间需要 4 分钟。

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

22010 40241234 1111

Sample Output

82400974

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**********************************************************************/

转载地址:http://tzwuz.baihongyu.com/

你可能感兴趣的文章
MySQL 的全局锁、表锁和行锁
查看>>
mysql 的存储引擎介绍
查看>>
MySQL 的存储引擎有哪些?为什么常用InnoDB?
查看>>
Mysql 知识回顾总结-索引
查看>>
Mysql 笔记
查看>>
MySQL 精选 60 道面试题(含答案)
查看>>
mysql 索引
查看>>
MySQL 索引失效的 15 种场景!
查看>>
MySQL 索引深入解析及优化策略
查看>>
MySQL 索引的面试题总结
查看>>
mysql 索引类型以及创建
查看>>
MySQL 索引连环问题,你能答对几个?
查看>>
Mysql 索引问题集锦
查看>>
Mysql 纵表转换为横表
查看>>
mysql 编译安装 window篇
查看>>
mysql 网络目录_联机目录数据库
查看>>
MySQL 聚簇索引&&二级索引&&辅助索引
查看>>
Mysql 脏页 脏读 脏数据
查看>>
mysql 自增id和UUID做主键性能分析,及最优方案
查看>>
Mysql 自定义函数
查看>>