• 1175:除以13


    传送门:http://ybt.ssoier.cn:8088/problem_show.php?pid=1175

    1175:除以13


    时间限制: 1000 ms         内存限制: 65536 KB
    提交数: 3377     通过数: 2109

    【题目描述】

    输入一个大于0的大整数N,长度不超过100位,要求输出其除以13得到的商和余数。

    【输入】

    一个大于0的大整数,长度不超过100位。

    【输出】

    两行,分别为整数除法得到的商和余数。

    【输入样例】

    2132104848488485

    【输出样例】

    164008065268345
    0





    高精除低精

     1 #include<iostream>
     2 #include<cstring>
     3 #define N 410
     4 using namespace std;
     5 string a;
     6 int as[N],yu,lena,ans[N],tot=0;
     7 int main(){
     8     cin>>a;
     9     lena=a.size();
    10     for(int i=0;i<lena;i++)as[i]=a[i]-'0';
    11     for(int i=0;i<lena;i++){
    12         ans[++tot]=(yu*10+as[i])/13;
    13         yu=(yu*10+as[i])%13;
    14     }
    15     int l=1;
    16     while(ans[l]==0&&l<tot)l++;
    17     for(int i=l;i<=tot;i++)cout<<ans[i];
    18     cout<<endl<<yu<<endl;
    19 }

  • 相关阅读:
    Hadoop 2.5.1集群安装配置
    Hadoop 2.5.1编译
    CloudStack安装
    Swift安装
    频率分布折线图与总体密度曲线
    频率直方图(hist)
    分位数(quantile)
    茎叶图(stem)
    盒图(boxplot)
    R语言学习
  • 原文地址:https://www.cnblogs.com/jzxnl/p/11031363.html
Copyright © 2020-2023  润新知