1 条题解

  • 0
    @ 2021-6-15 12:53:14

    C :

    #include <stdio.h>
    #include <stdlib.h>
    int main()
    {
    	int i;
        for(i=100000;i<=199999;i++)
        {
    		if((i*3)==((i%100000)*10+i/100000)) printf("%d",i);
        
        }
    	return 0;
    }
    
    

    C++ :

    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	int a,b,c,d,e;
    	for(int a=1;a<=9;++a)
    	for(int b=1;b<=9;++b)
    	for(int c=1;c<=9;++c)
    	for(int d=1;d<=9;++d)
    	for(int e=1;e<=9;++e)
    	{
    		int ans=1*100000+a*10000+b*1000+c*100+d*10+e;
    		int tmp=a*100000+b*10000+c*1000+d*100+e*10+1;
    		if(tmp%ans==0&&tmp/ans==3)
    		cout << ans << endl;
    	}
    	return 0;
    }
    

    Pascal :

    var
    a,i:longint;
    begin
      for i:=111111 to 199999 do
      begin
      a:=(i-100000)*10+1;
      if i*3=a then begin write(i);break; end;
      end;
    end.
    
    • 1

    信息

    ID
    587
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者