https://vjudge.net/problem/SPOJ-LASTDIG

求最后一位,%10就完了

这个题居然要求代码小于等于700B

#include <iostream>
#include <cstdio>
#define p(a) putchar(a)
#define For(i,a,b) for(long long i=a;i<=b;++i) using namespace std;
long long T,n,x,y; long long ksm(long long a,long long b){
long long r=;
while(b>){
if(b&)
r=r*a%;
a=a*a%;
b>>=;
}
return r;
} int main(){
cin>>T;
while(T--){
cin>>x>>y;
cout<<ksm(x,y);p('\n');
}
return ;
}

SPOJ - The last digit的更多相关文章

  1. SPOJ #5 The Next Palindrome

    "not more than 1000000 digits" means an efficient in-place solution is needed. My first so ...

  2. SPOJ BALNUM - Balanced Numbers - [数位DP][状态压缩]

    题目链接:http://www.spoj.com/problems/BALNUM/en/ Time limit: 0.123s Source limit: 50000B Memory limit: 1 ...

  3. BZOJ 2588: Spoj 10628. Count on a tree [树上主席树]

    2588: Spoj 10628. Count on a tree Time Limit: 12 Sec  Memory Limit: 128 MBSubmit: 5217  Solved: 1233 ...

  4. [LeetCode] Nth Digit 第N位

    Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n i ...

  5. [LeetCode] Number of Digit One 数字1的个数

    Given an integer n, count the total number of digit 1 appearing in all non-negative integers less th ...

  6. SPOJ DQUERY D-query(主席树)

    题目 Source http://www.spoj.com/problems/DQUERY/en/ Description Given a sequence of n numbers a1, a2, ...

  7. [Leetcode] Number of Digit Ones

    Given an integer n, count the total number of digit 1 appearing in all non-negative integers less th ...

  8. SPOJ GSS3 Can you answer these queries III[线段树]

    SPOJ - GSS3 Can you answer these queries III Description You are given a sequence A of N (N <= 50 ...

  9. 【Codeforces715C&716E】Digit Tree 数学 + 点分治

    C. Digit Tree time limit per test:3 seconds memory limit per test:256 megabytes input:standard input ...

随机推荐

  1. 一幅图解决R语言绘制图例的各种问题

    一幅图解决R语言绘制图例的各种问题 用R语言画图的小伙伴们有木有这样的感受,"命令写的很完整,运行没有报错,可图例藏哪去了?""图画的很美,怎么总是图例不协调?" ...

  2. UVA-10200-Prime Time-判断素数个数(打表预处理)+精度控制

    题意: 给出a.b区间,判断区间内素数所占百分比 思路: 注意提前打表和控制精度1e-8的范围足够用了 细节: 精度的处理 判断素数的方法(且返回值为bool) 数据类型的强制转换 保存素数个数 提前 ...

  3. Codeforces 1174A Ehab Fails to Be Thanos

    题目链接:codeforces.com/problemset/problem/1174/A 题意:给定长度2n 的数组,改变数组顺序,使得前 n 个数的和不等于 后 n 个数的和,不行输出-1. 思路 ...

  4. 11-MySQL-Ubuntu-数据表中数据的删除(四)

    数据的删除(delete) (1)物理删除(不可逆,公司不会采取这种方法,如现在一般不会出现注销,数据具有无限价值) 删除整张表的数据!!! delete from 表名; 删除部分给定条件的数据: ...

  5. Jmeter----函数助手参数化

    要填写开始日期和结束日期和赋值的变量名

  6. Vue键盘事件

    键盘事件一 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <tit ...

  7. XSS攻击原理

    本文转载的地址:http://www.2cto.com/Article/201209/156182.html Xss(cross-site scripting)攻击指的是攻击者往Web页面里插入恶意h ...

  8. day18 函数定义、参数;名称空间;全局变量及局部变量。

    Python之路,Day6 = Python基础6 函数的定义 def func1(): # 定义一个函数,名字叫func1,括号中没有传入参数 print('hello word') # 这里是 f ...

  9. agc38C LCMs

    https://atcoder.jp/contests/agc038/tasks/agc038_c 题意:给\(a_i\),求\(\sum_{i=1}^n\sum_{j=i+1}^nlcm(a_i,a ...

  10. echarts折线区域图

    一.使用场景 当舒张压和收缩压超过或低于他们对应的范围时,折线应该给与不同颜色.两个指标对应的范围也要填充不同的颜色. 二.实现方案 主要使用了echarts中的visualMap,series.ma ...