没有正解,都是我的暴力

 

T1

枚举两个金币个数

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int a,b,ans;
int c[10000];

int main()
{  
    scanf("%d%d",&a,&b);
    if(a>b)swap(a,b);
    for(int i=0;i<100;i++)
    {
        for(int j=0;j<=100;j++)
        {
            c[a*i+b*j]=true;
        }
    }
    int js=0;
    for(int i=0;i<=a*b;i++)
    {
        if(c[i])js=0;
        else ans=i,js++;
    }
    cout<<ans<<endl;
    return 0;
}
View Code

相关文章:

  • 2021-06-09
  • 2021-07-04
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-01-10
猜你喜欢
  • 2022-02-08
  • 2021-09-11
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
相关资源
相似解决方案