题目背景

为了让大家紧张的心情放松一下,这一题题是一道非常简单的题目。

题目描述

给出正整数N和M,请你计算N div M(N/M的下取整)。

输入输出格式

输入格式:

一行,两个正整数,N和M。

输出格式:

一行,一个整数,表示N div M。

输入输出样例

输入样例#1: 复制

1000 333
输出样例#1: 复制

3

说明

• 对于60%的数据:N,M ≤ 750!,答案≤ 7!。

• 对于100%的数据:N,M ≤ 6250!,答案≤ 13!。

请注意:上面的两句话并不是感叹句,而是陈述句。标点符号使用没有错误。

思路:模拟。

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
string a1,b1;
int a[],b[];
int c[],t[];
int compare(int aa[],int bb[]){
if(aa[]>bb[]) return ;
if(aa[]<bb[]) return -;
for(int i=aa[];i>;i--){
if(aa[i]>bb[i]) return ;
if(aa[i]<bb[i]) return -;
}
return ;
}
void numcpy(int aa[],int bb[],int l){
for(int i=;i<=aa[];i++) bb[i+l-]=aa[i];
bb[]=aa[]+l-;
}
int main(){
cin>>a1>>b1;
a[]=a1.size();
b[]=b1.size();
c[]=a[]-b[]+;
for(int i=;i<=a[];i++) a[i]=a1[a[]-i]-;
for(int i=;i<=b[];i++) b[i]=b1[b[]-i]-;
for(int i=c[];i>;i--){
memset(t,,sizeof(t));
numcpy(b,t,i);
while (compare(a,t)>=){
c[i]++;
if(!compare(a,t)){ a[]=;continue; }
for(int i=;i<=a[];i++){
if (a[i]<t[i]){ a[i+]--;a[i]+=; }
a[i]-=t[i];
}
while(a[]>&&!a[a[]]) a[]--;
}
}
while(c[]>&&!c[c[]]) c[]--;
if(!c[]) cout<<<<endl;
else for(int i=c[];i>;i--) cout<<c[i];
}

洛谷 P2005 A/B Problem II的更多相关文章

  1. 洛谷1001 A+B Problem

    洛谷1001 A+B Problem 本题地址:http://www.luogu.org/problem/show?pid=1001 题目描述 输入两个整数a,b,输出它们的和(|a|,|b|< ...

  2. 洛谷1303 A*B Problem 解题报告

    洛谷1303 A*B Problem 本题地址:http://www.luogu.org/problem/show?pid=1303 题目描述 求两数的积. 输入输出格式 输入格式: 两个数 输出格式 ...

  3. 洛谷1601 A+B Problem(高精) 解题报告

    洛谷1601 A+B Problem(高精) 本题地址:http://www.luogu.org/problem/show?pid=1601 题目背景 无 题目描述 高精度加法,x相当于a+b pro ...

  4. 洛谷P1865 A % B Problem

    1.洛谷P1865 A % B Problem 题目背景 题目名称是吸引你点进来的 实际上该题还是很水的 题目描述 区间质数个数 输入输出格式 输入格式: 一行两个整数 询问次数n,范围m 接下来n行 ...

  5. 洛谷 P2616 [USACO10JAN]购买饲料II Buying Feed, II

    洛谷 P2616 [USACO10JAN]购买饲料II Buying Feed, II https://www.luogu.org/problemnew/show/P2616 题目描述 Farmer ...

  6. 洛谷 P1182 数列分段 Section II

    洛谷 P1182 数列分段 Section II 洛谷传送门 题目描述 对于给定的一个长度为N的正整数数列A-iA−i,现要将其分成M(M≤N)M(M≤N)段,并要求每段连续,且每段和的最大值最小. ...

  7. 洛谷P3412 仓鼠找$Sugar\ II$题解(期望+统计论?)

    洛谷P3412 仓鼠找\(Sugar\ II\)题解(期望+统计论?) 标签:题解 阅读体验:https://zybuluo.com/Junlier/note/1327573 原题链接:洛谷P3412 ...

  8. 洛谷P1288 取数游戏II(博弈)

    洛谷P1288 取数游戏II 先手必胜的条件需要满足如下中至少 \(1\) 条: 从初始位置向左走到第一个 \(0\) 的位置,经过边的数目为偶数(包含 \(0\) 这条边). 从初始位置向右走到第一 ...

  9. 洛谷P1919 A*B problem 快速傅里叶变换模板 [FFT]

    题目传送门 A*B problem 题目描述 给出两个n位10进制整数x和y,你需要计算x*y. 输入输出格式 输入格式: 第一行一个正整数n. 第二行描述一个位数为n的正整数x. 第三行描述一个位数 ...

随机推荐

  1. 使用xshell连接本地虚拟机中的Linux问题

    xshell 连接虚拟机中Linux报错: Could not connect to '192.168.8.120' (port 22):Connection failed. 原因:虚拟机中Linux ...

  2. ZBrush雕刻生物小技巧

    本教程主要学习如何使用ZBrush®3D图形绘制软件的工具和笔刷雕刻酷酷的生物造型,我们今天来看看在游戏.媒体和电视领域有着十几年丰富经验的3D角色艺术家Francis-Xavier Martins是 ...

  3. URL正则

    现有需求 表单填写域名只能填写 baseURL 或者 baseURL+端口 不带协议 否则为不合法 String url1 = ".com:90"; String url2 = & ...

  4. JSON.stringify(),JSON.parse(),eval(string)

      JSON.stringify()用于从一个对象解析出字符串 : var obj = {"name":"week","age":" ...

  5. Keepalived原理及VRRP协议与应用配置(详细)

    转载自:https://blog.csdn.net/u010391029/article/details/48311699 1. 前言 VRRP(Virtual Router Redundancy P ...

  6. 洛谷 P2665 [USACO08FEB]连线游戏Game of Lines

    P2665 [USACO08FEB]连线游戏Game of Lines 题目背景 Farmer John最近发明了一个游戏,来考验自命不凡的贝茜. 题目描述 Farmer John has chall ...

  7. nginx php No input file specified 怎样处理?

    配置nginx支持php 出现了No input file specified ? 仅仅要改动下安装文件夹下的  nginx.conf下的 location ~ \.php$ {           ...

  8. SCN 时间戳的相互转换

    SQL> select * from v$version where rownum=1; BANNER --------------------------------------------- ...

  9. @SpringBootApplication cannot be resolved to a type In STS

    @SpringBootApplication cannot be resolved to a type In STS 学习了:https://stackoverflow.com/questions/4 ...

  10. Android蓝牙技术Bluetooth使用流程(具体解释)

    一:蓝牙设备之间的通信主要包含了四个步骤 设置蓝牙设备 寻找局域网内可能或者匹配的设备 连接设备 设备之间的传输数据 二:详细编程实现 1. 启动蓝牙功能 首先通过调用静态方法getDefaultAd ...