首页 > 其他分享 >A. Simple Design

A. Simple Design

时间:2024-04-22 23:55:23浏览次数:26  
标签:10 Simple sum int while Design

A. Simple Design

看来0~1000分区间还是有简单题的()
就是暴力找每个数,把它每个位置分离相加
找到就退出

#include <iostream>
using namespace std;



void solve()
{
    int x, k;
    cin >> x >> k;
    for (int i = x;; i ++ )
    {
        int d = i;
        int sum = 0;
        while (d)
        {
            sum += d % 10;
            d /= 10;
        }
        if (sum % k == 0)
        {
            cout << i << endl;
            return;
        }
    }
}

int main()
{
    int t;
    cin >> t;
    while (t -- )
    {
        solve();
    }
    return 0;
}

标签:10,Simple,sum,int,while,Design
From: https://www.cnblogs.com/isomer/p/18151867

相关文章

  • MIT 6.5830 simpleDB Lab2
    Exercise1需要完成的是:src/java/simpledb/execution/Predicate.javasrc/java/simpledb/execution/JoinPredicate.javasrc/java/simpledb/execution/Filter.javasrc/java/simpledb/execution/Join.java这里主要实现两个功能:Filter:通过Predicate过滤一部分满足条件的Tupl......
  • perf/Simpleperf 生成火焰图
    参考:https://blog.csdn.net/weixin_43297891/article/details/137241935 https://hqber.com/archives/483/定义Simpleperf是Google随NDK一起发布的一款profile工具(注:从NDKr13开始),它是针对Android平台的一个native层性能分析工具。使用步骤本篇是分析运行在android设备......
  • 新手大白话 [SWPU 2018]SimplePHP Phar反序列化
    今天再做个Phar反序列化巩固下。进入题目发现了查看文件与上传文件,与自己的IP。利用burp抓包进行查看,先尝试index.php,发现base.php,查看base.php发现flag所在文件,再查看file.php,发现function.phpclass.php点击查看代码class.php<?phpclassC1e4r{public$t......
  • Principles of Object Oriented Class Design
    PrinciplesofObjectOrientedClassDesignhttps://staff.cs.utu.fi/~jounsmed/doos_06/material/DesignPrinciplesAndPatterns.pdfTheOpenClosedPrinciple(OCP)1Amoduleshouldbeopenforextensionbutclosedformodification.Ofalltheprinciplesofobjec......
  • 转载Using Domain-Driven Design(DDD)in Golang
    转载自:https://dev.to/stevensunflash/using-domain-driven-design-ddd-in-golang-3ee5UsingDomain-DrivenDesign(DDD)inGolang#go#ddd#redis#postgresDomain-DrivenDesignpatternisthetalkofthetowntoday.Domain-DrivenDesign(DDD)isanapproachtosoft......
  • MIT 6.5830 simpleDB Lab1
    Exercise1需要完成的代码有:src/java/simpledb/storage/TupleDesc.javasrc/java/simpledb/storage/Tuple.javaTuple是simpleDB的元组,由多个Field(字段)组成,TupleDesc负责描述Tuple中各个Field对应的schema。Tuple.java代码:packagesimpledb.storage;importjava.io.Serial......
  • System Design Interview
    1ProximityService1)requirements FunctionalRequirementsNon-FunctionalRequirements1Returnallbusinessesbasedonuser'slocation(latituteandlongitutepair)andradius(5km)Lowlatency.Usersseenearbybusinessquickly2B......
  • Vue3、AntDesignModal、useModal.js封装组件
    useModal.jsimport{nextTick,ref}from'vue'import{isFunction}from"lodash-es";exportfunctionuseModal(){ constvisible=ref(false) constloading=ref(false) constshowModal=()=>{ visible.value=true } con......
  • PowerDesigner 业务流程/数据建模软件和元数据管理解决方案
    拓展阅读数据库设计工具-08-概览数据库设计工具-08-powerdesigner数据库设计工具-09-mysqlworkbench数据库设计工具-10-dbdesign数据库设计工具-11-dbeaver数据库设计工具-12-pgmodeler数据库设计工具-13-erdplus数据库设计工具-14-NavicatDataModeler数据库设计工具-......
  • simple_ffmpeg_decoder(ffmpeg的解码器)
    代码#include<stdio.h>#define__STDC_CONSTANT_MACROS//因为ffmpeg是C语言编写的所以要继承C语言的语法格式extern"C"{#include"libavcodec/avcodec.h"#include"libavformat/avformat.h"#include"libswscale/swscale.h"};intmain(i......