Problem G: 圆周率
Problem G: 圆周率
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 155 Solved: 99
[Submit][Status][Web Board]
Description
Input
Output
Sample Input
6
1 10 7829
2 7 12345
3 6 432504023545112
4 8 37777777777777773
5 2 101011111111110000000000000000000011111111111111111111111
6 10 145784444444444457842154777777777547845993
Sample Output
1 8
2 3
3 1
4 6
5 0
6 6
#include<stdio.h>
#include<string.h>
int main()
{
int p,k,t;
int now=0;
char str[1000005];
scanf("%d",&p);
while(p--)
{
scanf("%d%d%s",&t,&k,&str);
now=0;
int i;
int len=strlen(str);
for(i=0;i<len;i++)
{
now=now*k;
now=now+str[i]-'0';
now=now%(k-1);
}
printf("%d %d\n",t,now);
}
}
Problem G: 圆周率的更多相关文章
- 实验9:Problem G: 克隆人来了!
想要输出""的话: cout<<"A person whose name is \""<<name<<" ...
- 实验12:Problem G: 强悍的矩阵运算来了
这个题目主要是乘法运算符的重载,卡了我好久,矩阵的乘法用3个嵌套的for循环进行,要分清楚矩阵的乘法结果是第一个矩阵的行,第二个矩阵的列所组成的矩阵. 重载+,*运算符时,可以在参数列表中传两个矩阵引 ...
- 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem G: Check The Check(模拟国际象棋)
Problem G: Check The Check Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 10 Solved: 3[Submit][Statu ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem G
Problem G Good Teacher I want to be a good teacher, so at least I need to remember all the student n ...
- 【贪心+中位数】【新生赛3 1007题】 Problem G (K)
Problem G Time Limit : 4000/2000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Sub ...
- Problem G: If We Were a Child Again
Problem G: If We Were a Child AgainTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solved: 14[Submi ...
- Problem G: Keywords Search
Problem G: Keywords SearchTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 10 Solved: 6[Submit][Status] ...
- BZOJ4977 八月月赛 Problem G 跳伞求生 set 贪心
欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - BZOJ4977 - 八月月赛 Problem G 题意 小明组建了一支由n名玩家组成的战队,编号依次为1到n ...
- Western Subregional of NEERC, Minsk, Wednesday, November 4, 2015 Problem G. k-palindrome dp
Problem G. k-palindrome 题目连接: http://opentrains.snarknews.info/~ejudge/team.cgi?SID=c75360ed7f2c7022 ...
随机推荐
- poj 1655 Balancing Act(找树的重心)
Balancing Act POJ - 1655 题意:给定一棵树,求树的重心的编号以及重心删除后得到的最大子树的节点个数size,如果size相同就选取编号最小的. /* 找树的重心可以用树形dp或 ...
- winform中的Datagridview控件与List同步修改
Winform的datagridview是个很强大的控件,可用datatable, List等型的数据与之绑定显示. 可惜的是,绑定的LIst不能同步更新. 估计是为了改进List不能同步更新的问题, ...
- Vue中全局导入和按需导入的区别
export {router} //按需导出 import {router} from './router' //按需导入路由模块 export default //全局导出store模块 store ...
- Helvetic Coding Contest 2016 online mirror B1
Description The zombies are gathering in their secret lair! Heidi will strike hard to destroy them o ...
- 纯干货:Linux抓包命令集锦
/******************************************************************************************* 版权声明* 本 ...
- python3——“->”的含义
->:标记返回函数注释,信息作为.__annotations__属性提供,__annotations__属性是字典.键return是用于在箭头后检索值的键.但是在Python中3.5,PEP 4 ...
- set<int> 的用法
博客学习:https://blog.csdn.net/yas12345678/article/details/52601454 介绍一下 *max_element(a,a+n) 求取数组最大的元素 ...
- HDU 5734 A - Acperience
http://acm.hdu.edu.cn/showproblem.php?pid=5734 Problem Description Deep neural networks (DNN) have s ...
- Sqoop Import HDFS
Sqoop import应用场景——密码访问 注:测试用表为本地数据库中的表 1.明码访问 sqoop list-databases \ --connect jdbc:mysql://202.193. ...
- 服务器部署nginx报错 nginx: [warn] conflicting server name "localhost" on xxx.xxx.xxx.xxx:80, ignored
问题 修改nginx配置参数后,使用nginx -t检查配置. 提示successfull后就可以使用 nginx -s reload来重新加载配置 我配置的过程中遇到这样的问题,就是绑定了主机名后, ...