1 条题解

  • 0
    @ 2025-10-10 15:45:26

    C :

    #include<stdio.h>
    int main()
    {
     int i=100;
     while((i%3==2 && i%5==3 && i%7==5)!=1) 
     i++;
     printf("%d",i);
    }
    

    C++ :

    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    int main(){
        int i;
        for(i=100;i<=100000000;i++){
        	if(i%3==2&&i%5==3&&i%7==5){
        		cout<<i<<endl;
        		break;
    		}
    	}
    }
    

    Pascal :

    var i:longint;
    begin
      for i:=1 to 200 do
       if (i mod 3=2)and(i mod 5=3)and(i mod 7=5)and(i>100) then
        begin
         writeln(i);
         break;
        end;
    end.
    
    

    Java :

    public class Main{
    	public static void main(String[] args) {
    		for(int i=100;i<200;i++){
    			if((i%3==2)&&(i%5==3)&&(i%7==5)){
    				System.out.println(i);
    			}
    		}
    	}
    }
    

    Python :

    s=100
    while s<200:
        if s%3==2 and s%5==3 and s%7==5:       
            print(s)
        s+=1
    
    
    • 1

    信息

    ID
    16
    时间
    1000ms
    内存
    512MiB
    难度
    10
    标签
    递交数
    1
    已通过
    1
    上传者