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 ...
随机推荐
- ASP.NET控件之RequiredFieldValidator控件
作用:对textbox或者其他输入框进行非空验证: 属性:ControlToValidate (选择要指向的控件) ErrorMessage(错误,输入要显示的错误信息) 应用方法: 原型: Demo ...
- Cogs 465. 挤牛奶
465. 挤牛奶 ★ 输入文件:milk2.in 输出文件:milk2.out 简单对比时间限制:1 s 内存限制:128 MB [问题描述] 三个农民每天清晨5点起床,然后去牛棚给3 ...
- Mybatis插件Plugin
Mybatis开源Plugin中最熟知的pagehelper,重点made in China 很多人开始用pagehelper时候,肯定很纳闷,以mysql为例,明明没有加limit语句,为什么打印出 ...
- spring mvc做上传图片,文件小于10k就不生成临时文件了
这是spring-mvc.xml中的 <bean id="multipartResolver" class="org.springframework.web.mul ...
- Github搭建个人博客
Github的搭建博客真的是非常容易,所需的步骤只有三个:要完成自己的github.io博客网站,总共分三步:开通自己的github.io repo,选择一款Jekyll的主题,编写并发布博客.下面将 ...
- CentOS6.5安装MySQL5.7(也适合其他版本安装)
1.查看是否已经安装过mysql或其依赖,若已装过要先将其删除,否则第4步使用yum安装时会报错: 方法一:yum list installed | grep mysql 方法二:rpm -qa | ...
- Sharepoint JSCOM 列表操作
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveListItemsInclude); //确保js文件加载,再执行方法 function ...
- 聊聊tcpdump与Wireshark抓包分析
1 起因# 前段时间,一直在调线上的一个问题:线上应用接受POST请求,请求body中的参数获取不全,存在丢失的状况.这个问题是偶发性的,大概发生的几率为5%-10%左右,这个概率已经相当高了.在排查 ...
- Maven的作用到底是什么
1 . 帮你下载jar包 maven项目会有一个 pom.xml文件, 在这个文件里面,只要你添加相应配置,他就会自动帮你下载相应jar包,不用你铺天盖地的到处搜索你需要的jar包了 下面是示范配置文 ...
- redis结合springboot 无法注入redisTemplate问题
报错: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean o ...