1 solutions
-
0
C :
#include<stdio.h> int suShu(int x){ int i; if(x>1){ int c=0; for(i=2;i<=x/2;i++){ if(x%i==0){ c++; break; } } if(c==0){ return 1; }else{ return 0; } }else{ return 0; } } int main() { int a,b; for(a=2;a<=100;a++){ for(b=a+1;b<=100;b++){ if(suShu(a)&&suShu(b)&&suShu((a+b)/2)&&(a+b)%2==0){ printf("%d %d %d\n",a,(a+b)/2,b); } } } return 0; }
Python :
import math def suShu(n): f = True for i in range (2 , int(math.sqrt(n))+1): if n % i == 0: f = False break; return f and n != 1 for i in range (1, 100): for e in range (i + 1, 100): if suShu(i) and suShu(e) and suShu((i+e)//2) and (i + e) % 2 == 0: print(i, (i+e)//2, e)
- 1
Information
- ID
- 10739
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By