1 solutions
-
0
C :
#include<stdio.h> int main() {int c,r,h,f; scanf("%d %d",&h,&f); c=(4*h-f)/2; r=h-c; printf("%d %d",c,r); return 0; }C++ :
#include<iostream> using namespace std; int main() { int head,foot,ji,tu; cin>>head>>foot; ji=(4*head-foot)/2; tu=head-ji; cout<<ji<<' '<<tu<<endl; return 0; }Pascal :
var head,foot,ji,tu:longint; begin readln(head,foot); tu:=(foot-(2*head))>>1; ji:=((4*head)-foot)>>1; writeln(ji,' ',tu); end.Python :
# x + y = a # 2x + 4y = b # x + 2y = b / 2 # y = b / 2 - a # x = a - y a , b = raw_input().split() a = int(a) b = int(b) y = (b >> 1) - a x = a - y print x , y
- 1
Information
- ID
- 20008
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By