codeforces1328A

文章目录[x]
  1. 1:题目链接
  2. 2:题意
  3. 3:思路
  4. 4:参考代码

csdn博客链接:https://nuoyanli.blog.csdn.net/article/details/105139176


题目链接

http://codeforces.com/contest/1328/problem/A

题意

组数据,每次给你两个数,对于一组,问你至少使增大多少,才可以被整除。

思路

  • 思路:若直接输出否则考虑,即,所以,要求的是至少的次数,又于是倍数递增,所以遍历最小的即可,时间复杂度是允许的。
  • 思路:若输出,否则输出即可。

参考代码

  • 参考代码
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define PB push_back
#define FI first
#define SE second
#define m_p(a, b) make_pair(a, b)
const double pi = acos(-1.0);
const double eps = 1e-9;
typedef long long LL;
const int N = 1e6 + 10;
const int M = 1e5 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double f = 2.32349;
void solve() {
  IOS;
  int t;
  cin >> t;
  while (t--) {
    LL a, b;
    cin >> a >> b;
    if (b >= a) {
      cout << b - a << endl;
    } else {
      int k = a / b;
      while (k * b < a) {
        k++;
      }
      cout << k * b - a << endl;
    }
  }
}
signed main() {
  solve();
  return 0;
}
  • 参考代码
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define PB push_back
#define FI first
#define SE second
#define m_p(a, b) make_pair(a, b)
const double pi = acos(-1.0);
const double eps = 1e-9;
typedef long long LL;
const int N = 1e6 + 10;
const int M = 1e5 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double f = 2.32349;
void solve() {
  IOS;
  int t;
  cin >> t;
  while (t--) {
    LL a, b;
    cin >> a >> b;
    if (a == b) {
      cout << 0 << endl;
    } else {
      cout << b - (a - (a / b) * b) << endl;
    }
  }
}
signed main() {
  solve();
  return 0;
}

 


点赞
  1. best cbd oil说道:

    You could certainly see your enthusiasm in the work you write.
    The sector hopes for more passionate writers like you who aren't afraid to mention how they believe.
    Always follow your heart.

  2. Briannix说道:

    viagra buy usa can we buy viagra over the counter where can i buy viagra in usa

  3. Briannix说道:

    where to buy real viagra to buy viagra online best site to buy viagra online

  4. Briannix说道:

    buy viagra generic buy viagra from canadian pharmacy buy generic viagra

  5. iamxqeunghqz说道:

    cialis 20 mg generic cialis canada https://spcialisps.com/# - where to buy cialis online cialis without prescription cialis price walmart

  6. 923411 face gets red from viagra

    viagra require prescription

    es cialis o viagra mejor uk

  7. 923411 buy viagra no rx canada

    viagra female uk

    viagra video effetti

  8. 923411 no prescripcin pfizer viagra

    viagra in sri lanka

    viagra online per nachnahme

  9. 923411 viagra generico barcelona

    prix gratuit viagra

    viagra precio en espaa

  10. 923411 generic viagra vega

    viagra generika

    acquisto viagra 100 mg

  11. 923411 cheap viagra with samples

    best viagra in ayurveda

    no prescripcin pfizer viagra

  12. 923411 prix viagra canada

    viagra kaufen

    viagra best price per pill

  13. BeardenSwanGar说道:

    cialis forum alfemminile

    https://ciasale20.com/ - very good site cialis stories
    buy generic cialis

    wow 5mg cialis samples

  14. BeardenSwanGar说道:

    cialis sale in india

    https://ciasale20.com/ - cialis senza ricetta medica
    para que serve o cialis 5mg

    cialis au ru en ligne

  15. BeardenSwanGar说道:

    cialis en lnea annimo

    https://ciasale20.com/ - online cialis
    online cialis

    walmart pharmacy cialis cost

  16. BeardenSwanGar说道:

    eu buy cialis

    https://ciasale20.com/ - cheap cialis
    cialis

    the cheapest cialis online

  17. BeardenSwanGar说道:

    cialis mejor viagr

    https://ciasale20.com/ - cialis uk discount
    online cialis

    small pink cialis pills

  18. BeardenSwanGar说道:

    follow link very cheap cialis

    https://ciasale20.com/ - cf cheap cialis
    fda approved cialis generic

    cialis stripes kaufen

  19. BeardenSwanGar说道:

    cialis rezeptfrei kamagra

    https://ciasale20.com/ - cialis generic en mexico
    cialis

    free cialis sample pack in usa

  20. BeardenSwanGar说道:

    the cheapest cialis online

    https://ciasale20.com/ - cialis
    wow 5mg cialis samples

    ou trouver du cialis a paris

  21. BeardenSwanGar说道:

    cialis cialis

    https://ciasale20.com/ - buy cialis
    purchase generic cialis soft

    name brand cialis cheap

  22. BeardenSwanGar说道:

    compre cialispills

    https://ciasale20.com/ - buy generic cialis
    cialis rezeptfrei kamagra

    cialis wirkung lasst nac

  23. BeardenSwanGar说道:

    comprare cialis farmaci

    https://ciasale20.com/ - only for you cialis ed
    cialis baratas

    cialis generic en mexico

  24. BeardenSwanGar说道:

    generic liquid cialis shot

    https://ciasale20.com/ - cheap cialis online
    cialis senza ricetta medica

    cialis 5 milligrams pilules

  25. BeardenSwanGar说道:

    cialis e trigliceridi

    https://ciasale20.com/ - recensioni cialis 5 mg
    we like it cialis usa

    cialis soft tablets online

  26. BeardenSwanGar说道:

    commander cialis achat

    https://ciasale20.com/ - deutschland cialis kaufen
    buy cialis

    prix cialis marseille

  27. BeardenSwanGar说道:

    the best choice soft cialis

    https://ciasale20.com/ - us overnight shipping cialis
    buy cialis jelly 5

    generika cialis levitra

  28. BeardenSwanGar说道:

    generic cialis names

    https://ciasale20.com/ - generic cialis online
    cialis online

    enseignement sp cialis

  29. BeardenSwanGar说道:

    cialis senza ricetta medica

    https://ciasale20.com/ - generic cialis
    buy cialis online

    cialis israel

  30. BeardenSwanGar说道:

    cialis mejor viagr

    https://ciasale20.com/ - generic cialis online
    buy cialis

    can i buy cialis in mexico

  31. BeardenSwanGar说道:

    online cialis orders canada

    https://ciasale20.com/ - online cialis
    online cialis

    cialis dove acquistare

  32. BeardenSwanGar说道:

    product team cialis

    https://ciasale20.com/ - cheap cialis online
    cheap off brand cialis

    cialis generika bewertung

  33. BeardenSwanGar说道:

    cialis 10 mg oder 5 mg

    https://ciasale20.com/ - free samples of cialis by mail
    things know cialis

    cialis 120 mg chino

  34. BeardenSwanGar说道:

    reviews cialis levitra vs vs

    https://ciasale20.com/ - cheap cialis
    generic cialis online

    cialis apotheke billig

  35. viagra en venta

    https://frviagrafrance.com/ - viagra generico preco bh
    acheter viagra sans ordonnance

    buy viagra oral jelly

  36. BeardenSwanGar说道:

    lilly cialis preis

    https://ciasale20.com/ - comprar genericos cialis
    buy genuine female cialis uk

    cialis y aspirina

  37. online viagra canada generic

    https://frviagrafrance.com/ - viagra vente
    prix viagra 50 mg en pharmacie

    film viagra salesman

  38. comprar viagra farmacia foro

    https://frviagrafrance.com/ - generico viagra femenino
    ciallis or viagra

    usefull link viagra doses

  39. just try prescription viagra

    https://deliveryviagranow.com/ - uk 50mg viagra sales
    try it viagra propranodol

    viagra varighed

  40. buying viagra la vegas

    https://frviagrafrance.com/ - generic viagra top
    viagra vente

    cheap viagra brand 150mg

  41. mexico viagra online

    https://frviagrafrance.com/ - generic cialis viagra combo
    viagra generique

    a mail order viagra

  42. ciallis or viagra

    https://frviagrafrance.com/ - we recommend buy viagra 50mg
    buy viagra in saudi

    achat viagra internet forum

  43. best legal viagra uk

    https://deliveryviagranow.com/ - viagra pharmacy on line
    viagra mercury drug store

    campione di cialis viagra

  44. dbhrniche说道:

    term papers for sale https://bestessaysold.com/ - edit my paper term papers for sale essay writing thesis writer

  45. viagra bestellen pillendienst

    https://frviagrafrance.com/ - effect of viagra on the heart
    viagra achat

    we recommend buy viagra 50mg

  46. dvlifielo说道:

    essay for you https://buyingpaperdil.com/ - college essay service pay for essay writing assignments custom research paper writing

  47. seo说道:

    [ SEO - BACKLİNK - HACKLİNK - BLACK OR WHİTE HAT ]
    - - - - - - - - - - - - - - - -

    1- Senin için yorum backlink yapabilirim.

    2- I can comment backlink for you.

    3- Ich kann den Backlink für Sie kommentieren.

    4- Я могу прокомментировать обратную ссылку для вас.

    [ SEO - BACKLİNK - HACKLİNK - BLACK OR WHİTE HAT ]

    - - - - - - - - - - - - - - - -

    WhatsApp = +9 0422 606 06 30
    Mail = Seo.Backlink.44@gmail.com

    Google Search = Seo Bayi
    seo

  48. viagra ad music

    https://frviagrafrance.com/ - viagra vs genericos
    enter site buy real viagra

    viagra 100 mg 30 tabletta

  49. Marydop说道:

    doxycycline hyc buy singulair buy chloroquine priligy price cymbalta otc where to buy celebrex hydroxychloroquine 40 mg buspar 30 mg pill silagra 50 mg buy baclofen

  50. Teodop说道:

    vermox over the counter canada

  51. Judydop说道:

    kamagra pills xenical drug buy tadalafil accutane online uk celebrex rx can i buy cymbalta in mexico buy silagra wellbutrin 300 mg cost sildenafil 100mg valtrex 1000 mg

发表评论

昵称和uid可以选填一个,填邮箱必填(留言回复后将会发邮件给你)
tips:输入uid可以快速获得你的昵称和头像