頭良くなりたい人

文系大学生shadeのブログです。競技プログラミングや人文学の話題,受験ネタなど。

ABC093 B - Small and Large Integers

問題はこちら atcoder.jp

方針

コード

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

int main(){
    int a,b,k;
    cin>>a>>b>>k;
    
    for(int i=0; i<k; i++){
        if(a+i>=((double)a+b)/2){
            break;
        }
        cout<<a+i<<endl;
    }

    for(int i=k-1; i>=0; i--){
        if(b-i<((double)a+b)/2){
            continue;
        }
        cout<<b-i<<endl;
    }
}