1 solutions
-
0
C :
#include <stdio.h> #include <stdlib.h> int main() { int a[6]; scanf("%d%d%d",&a[0],&a[1],&a[2]); if(a[2]-a[1]==a[1]-a[0]) { int i; for(i=3;i<6;i++) a[i]=a[i-1]+a[2]-a[1]; } else if(a[2]/a[1]==a[1]/a[0]) { int i; for(i=3;i<6;i++) a[i]=a[i-1]*(a[2]/a[1]); } printf("%d %d %d\n",a[3],a[4],a[5]); return 0; } //Author: ITProgrammer
C++ :
#include<iostream> using namespace std; int main(){ int a,b,c; cin>>a>>b>>c; if(c - b == b - a){ int t = c - b; cout<<c + t <<" " <<c + 2 * t <<" " << c + 3 * t<<endl; }else{ int t = c / b; cout<<c * t <<" " <<c * t * t <<" " << c * t * t * t<<endl; } return 0; }
Python :
a,b,c=map(int,input().split()) if c-b==b-a: t=c-b print(c+t,c+t+t,c+t+t+t) else: t=c//b print(c*t,c*t*t,c*t*t*t)
- 1
Information
- ID
- 10861
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By