NYOJ-485 A*B Problem【九余数定理】
来源:互联网 发布:一个黑帽seo的真实收入 编辑:程序博客网 时间:2024/06/14 10:01
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=485
解题思路:
经典的九余数定理,可以参考这篇文章:http://blog.csdn.net/niushuai666/article/details/6856109
代码如下:
#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<algorithm>using namespace std;int main(){int ncase;long long n, m;scanf("%d", &ncase);while(ncase--){long long temp;scanf("%lld%lld", &n, &m);if(n == 0 || m == 0){printf("0\n");continue;}temp = ((n % 9) * (m % 9)) % 9;if(temp == 0)printf("9\n");elseprintf("%lld\n", temp);}return 0;}
- NYOJ-485 A*B Problem【九余数定理】
- Hdu 1163 Eddy's digital Roots + NYOJ-485 A*B Problem(九余数定理)
- A*B Problem 485 (数学题+九余数定理)
- nyoj 485 九余数定理
- 求a+b及九余数定理
- nyoj 424 && 485(九余数定理)
- nyoj485 A*B Problem(九余数问题)
- NYOJ 485 A*B Problem
- nyoj-485-A*B Problem
- nyoj 485 A*B Problem
- NYOJ 485 A*B Problem
- NYOJ--485 A*B Problem
- NYOJ 485 A*B Problem
- NYOJ - A*B Problem
- NYOJ - A-B Problem
- NYoj A*B Problem
- NYOJ-A^B Problem
- NYOJ-A/B Problem
- 数据库的隔离级别
- jquery CheckBox 取消选中
- go语言学习-golang保留字
- 第四周实验报告2
- 三维坐标系下 使用opengl拾取物件的操作【新浪博客迁移】
- NYOJ-485 A*B Problem【九余数定理】
- 实例对比Oracle中truncate和delete的区别
- 分享八个实用的html小技巧
- Struts2 - Struts访问ServletAPI和OGNL学习(从零开始学习Strust2_07)
- bitset
- Index Similar DNA Sequence 多基因组索引技术 笔记
- Paul Graham:最伟大的创意都是令人恐惧的
- 手机的一些知识记录
- Oracle面试题汇总--3