zoukankan      html  css  js  c++  java
  • LightOJ-1078(数学)

    题意:给你一个n(0~1e6),前提是n不能被2和5整除,再给你一个10以内的数m,要求输出只由m组成的数(这个数能被n整除)的位数。

    其实题目很简单,模拟一下我们用的笔算除法的过程就好了,只要保证数字不溢出就好,但菜鸡的我竟然没有第一时间想到。。。麻打麻打打内,哎~

     1 #include<iostream>
     2 #include<cstdio>
     3 #include<cstring>
     4 #include<cmath>
     5 #define LL long long
     6 using namespace std;
     7 
     8 int main()
     9 {
    10     //ios::sync_with_stdio(false);
    11     LL t;
    12     scanf("%lld",&t);
    13     LL ans=0;
    14     for(int i=1;i<=t;i++)
    15     {
    16         ans=1;
    17         LL n,m; 
    18         scanf("%lld %lld",&n,&m);
    19         LL tt=m;
    20         while(m%n!=0)
    21         {
    22             m%=n;
    23             m=m*10+tt;
    24             
    25             ans++;
    26         }
    27         printf("Case %d: %d
    ",i,ans);
    28     //    cout<<"Case "<<i<<": "<<ans<<endl;
    29     }
    30 }
  • 相关阅读:
    搜索1009
    搜索1004
    Java文件操作
    搜索1007
    连接查询
    SQL学习——数据类型
    SQL学习——基本语法
    <转载>GIS数据下载网站大全
    DOM查询练习
    day09【继承、super、this、抽象类】
  • 原文地址:https://www.cnblogs.com/Oremix/p/7102415.html
Copyright © 2011-2022 走看看