AOJ ITP1 2.Branch on Condition

はい。
http://judge.u-aizu.ac.jp/onlinejudge/topic.jsp?cid=ITP1#problems/ITP1_2

A.Small, Large, or Equal

python

m,n=map(int,raw_input().split())
if m>n:print'a > b'
elif m<n:print'a < b'
else:print'a == b'

C++11

#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a>b){
        printf("a > b\n");
    }else if(a<b){
        printf("a < b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}

入力が特に示されていないけど負の数を含むintの範囲だけの2つの数を素直に比較すれば大丈夫だと思う。

B.Range

python

m,n,o=map(int,raw_input().split())
print'Yes'if m<n<o else'No'

C++11

#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a<b && b<c){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

繋げてa<b<cという比較は言語によって出来なかったりするらしい。

C.Sorting Three Numbers

python

a=map(int,raw_input().split());a.sort();print a[0],a[1],a[2]

sorted(map(int, raw_input().split()))と書くと受け取りながらソート出来るらしい。すげぇ!
C++11

#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
using namespace std;


int main(){
    vector<int> ar(3);
    for(auto&e:ar){
        scanf("%d",&e);
    }
    sort(ar.begin(),ar.end());
    printf("%d %d %d\n",ar[0],ar[1],ar[2]);
    return 0;
}

別にvectorじゃなくてarrayとかでもいいはずなのですけど、前にarrayでどうしてもコンパイルが通らないことがあったのでそれ以来はとりあえずでvector使うことにしてます。

D.Circle in a Rectangle

python

W,H,x,y,r=map(int,raw_input().split())
print'Yes'if(r<=x and(W-r)>=x)and(r<=y and(H-r)>=y)else'No'

C++11

#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    double pai=3.141592653589;
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

長方形と円の周が接するまではYesらしいので円の中点x,yが半径rの分だけ長方形の内側にあればはみ出さないはずだと思う。