1 条题解
-
0
C :
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int n=0,l=0; double m=0; while(1) { n++; m=sqrt(n+100); l=sqrt(n+100); if(m==l) { m=sqrt(n+268); l=sqrt(n+268); if(m==l) { printf("%d",n); break; } } } return 0; }
C++ :
#include<bits/stdc++.h> using namespace std; int main(){ int a=1; while(true){ if((int)sqrt(a+100)==sqrt(a+100)){ if((int)sqrt(a+268)==sqrt(a+268)){ break; } } a++; } cout<<a; return 0; }
Java :
public class Main { public static void main(String[] args) { for(int i = 1;;i++) { double a = Math.sqrt(i+100); double b = Math.sqrt(i+268); if((a % 2 == 1 | a % 2 == 0) && (b % 2 == 1 | b % 2 == 0)) { System.out.println(i); break; } } } }
Python :
import sys i=0; while True: if int((i+100)**0.5)*int((i+100)**0.5)==i+100 and int((i+268)**0.5)*int((i+268)**0.5)==i+268: print(i) sys.exit() i=i+1
- 1
信息
- ID
- 1523
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者