2 solutions

  • 0
    @ 2023-10-6 15:20:04

    这道题也不是特别的难

    #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;
    }
    
    • 0
      @ 2023-5-11 19:36:15
      #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;
      }
      
      
      
      
      
      
      • 1

      Information

      ID
      105
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      4
      Tags
      # Submissions
      698
      Accepted
      296
      Uploaded By