51nod 1116 K进制下的大数 (暴力枚举)
题意:中文题。
题解:暴力枚举。
#include <iostream>
#include <cstring> using namespace std; const int MAXS = 1e5 + ;
const int MAXK = ; char num[MAXS]; int main(int argc, const char * argv[])
{
while (cin >> num)
{
int sum = ;
int len = (int)strlen(num);
int MINK = ;
for (int i = ; i < len; i++)
{
if (num[i] >= '' && num[i] <= '')
{
if (num[i] - '' + > MINK)
{
MINK = num[i] - '' + ;
}
sum += num[i] - '';
}
else
{
if (num[i] - 'A' + > MINK)
{
MINK = num[i] - 'A' + ;
}
sum += num[i] - 'A' + ;
}
} bool flag = true;
for (int i = MINK; i <= MAXK; i++)
{
if (sum % (i - ) == )
{
flag = false;
cout << i << '\n';
break;
}
}
if (flag)
{
cout << "No Solution\n";
}
} return ;
}
51nod 1116 K进制下的大数 (暴力枚举)的更多相关文章
- 51nod 1116 K进制下的大数
你万万想不到,Long Long 就能存下的数据 #include <iostream> #include <cstdio> #include <cstdlib> ...
- 51Nod 1116 K进制下的大数(暴力枚举)
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> us ...
- 51 Nod 1116 K进制下的大数
1116 K进制下的大数 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题 收藏 关注 有一个字符串S,记录了一个大数,但不知这个大数是多少进制的,只知道这个数 ...
- [51nod1116]K进制下的大数
解题关键:$A\% (k - 1) = (A[0] + A[1]*k + A[2]*{k^2} + ...A[n]*{k^n})\% (k - 1) = (A[0] + A[1] + ...A[n]) ...
- A - K进制下的大数
https://vjudge.net/contest/218366#problem/A 中间溢出,注意求模. #include<iostream> #include<cstdio&g ...
- n!在k进制下的后缀0
问n! 转化成k进制后的位数和尾数的0的个数.[UVA 10061 How many zeros and how many digits?] Given a decimal integer numbe ...
- bzoj 3000 Big Number 估算n!在k进制下的位数 斯特林公式
题目大意 求n!在k进制下的位数 2≤N≤2^31, 2≤K≤200 分析 作为数学没学好的傻嗨,我们先回顾一下log函数 \(\log_a(b)=\frac 1 {log_b(a)}\) \(\lo ...
- 求x!在k进制下后缀零的个数(洛谷月赛T1)
求x!在k进制下后缀和的个数 20分: 求十进制下的x!后缀和的个数 40分: 高精求阶乘,直接模拟过程 (我不管反正我不打,本蒟蒻最讨厌高精了) 60分 利用一个定理(网上有求x!在 ...
- 陕西师范大学第七届程序设计竞赛网络同步赛 F WWX的礼物【数学/k进制下x^n的位数/log】
链接:https://www.nowcoder.com/acm/contest/121/F来源:牛客网 题目描述 WWX的女朋友送给了他一个礼物,可是礼物却被一把K进制密码锁锁住了.在礼物盒上还有一张 ...
随机推荐
- Todd's Matlab讲义第3讲:牛顿法和for循环
方程数值求解 下面几讲,我们将聚集如下方程的解法: \begin{equation} f(x)=0 \tag{3.1}\label{3.1} \end{equation} 在微积分课程中,我们知道,许 ...
- Codeforces Round #270 1002
Codeforces Round #270 1002 B. Design Tutorial: Learn from Life time limit per test 1 second memory l ...
- 微信公众平台开放JS-SDK(微信内网页开发工具包)
微信公众平台开放JS-SDK(微信内网页开发工具包),这次开放接口是质的飞跃,是对开发者和广大用户一个利好的消息.未来的公众号图文消息会更丰富多彩,准备脑洞大开吧!(第三方平台正式支持接入微信公众平台 ...
- Mac Pro Office Word 2011 个性化设置
操作系统:Mac Pro OS X 10.11.5 1.常用的几个操作: (1).视图 -> 功能区 (2).视图 -> 打印版式 (3).视图 -> 大纲 (4).视图 -> ...
- OS X Framework Library not loaded: 'Image not found'的解决办法
参考:OS X Framework Library not loaded: 'Image not found' 1.首先将相应的framework手动复制到/System/Library/Framew ...
- Ubuntu下安装php7后无法启动Apache
报错提示:Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You nee ...
- Redis学习笔记一:数据结构与对象
1. String(SDS) Redis使用自定义的一种字符串结构SDS来作为字符串的表示. 127.0.0.1:6379> set name liushijie OK 在如上操作中,name( ...
- webpack 教程 那些事儿01-webpack是什么
文章目录 1. 为什么引入webpack? 2. webpack到底是什么? 3. webpack的工作流程理念 4. webpack的使用 4.1. install webpack 5. 分享源码d ...
- Unity 用户手册用户指南二维纹理 (Texture 2D)
http://www.58player.com/blog-2327-953.html 二维纹理 (Texture 2D) 纹理 (Textures) 使您的 网格 (Meshes).粒子 (Parti ...
- 多通道(Multichannel)单通道(singlechannel)图像概念梳理
在做机器视觉时,常常要将一个多通道图像分离成几个单通道图像或者将几个单通道图像合成一个多通道图像,以方便图像处理,但是.写这篇博客,是为加深对这两个概念的理解,下面会给出部分OpenCV对单通道与多通 ...