我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Calculation 计算问题怎么实现的

Problem Description
Assume that f(0) = 1 and 0^0=1. f(n) = (n%10)^f(n/10) for all n bigger than zero. Please calculate f(n)%m. (2 ≤ n , m ≤ 10^9, x^y means the y th power of x).

Input
The first line contains a single positive integer T. which is the number of test cases. T lines follows.Each case consists of one line containing two positive integers n and m.

Output
One integer indicating the value of f(n)%m.

Sample Input
2
24 20
25 20

Sample Output
16
5

近期文章

  • visual stdio生成计时却看不到这类信息
  • stm 32控制lcd 1602
  • IIS,通过域账户登录失败
  • 树莓派下python成功安装opencv库 虚拟环境下无法调用
  • 用户输入一个数字n,输出n的绝对值
  • mini2440怎么用nfs挂载根文件系统
  • 在金字塔中垂直打印姓名
  • c++,cmake,跨平台
  • 豆瓣可播放电影的信息
  • Cow Sorting 的排序问题
  • 怎样提升音频采集过程中低码率的问题
  • 基于选择实验法的市场份额模拟
  • vbs真的过时了吗?
  • 抠图颜色会变蓝或者有偏差
  • pyecharts算下载成功了吗
  • 自定义神经网络保存为h5文件
  • 出现error c2679怎么解决
  • 出现下面错误该怎么改
  • 在三行中依次输入初始存款金额,存款年限,年利率,每年末计一次利息并转为本金,计算并输出存款到期时的利息(不含本金,税前),结果保留俩位小数
  • 关于Repository 怎么实现

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华