Information
- ID
- 105
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 4
- Tags
- # Submissions
- 737
- Accepted
- 317
- Uploaded By
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
int count = 0;
for (int x = 1; x <= 2021; ++x)
{ // x从1到2021
for (int y = 1; y <= 2021; ++y)
{ //y从1到2021
if (x * y <= 2021)
{
count++; // 如果 x * y 不超过 2021,则满足条件,增加计数
}
}
}
cout <<count << endl;
return 0;
}
#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int a[N], tmp[N];
int main()
{
int res=0;
for(int i=1;i<=2021;i++)
{
for(int j=1;j<=2021;j++)
{
if(i*j<=2021)
res++;
}
}
printf("%d",res);
return 0;
}
By signing up a 追梦算法网 universal account, you can submit code and join discussions in all online judging services provided by us.