본문 바로가기

C++

백준 C++ 21598,21612,22938,22966,23037,23234,23795,23825,24568,25083,25238

#21598

#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    for (int i=0;i<n;i++){
        cout << "SciComLove" <<'\n';
    }

    return 0;
}

#21612

#include <iostream>
using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int b;
    cin >> b;
    int p = 5*b - 400;
    cout<<p<<'\n';

    if(p>100){
        cout<<-1;
    }
    else if(p<100){
        cout<<1;
    }
    else{
        cout<<0;
    }
    return 0;
}

#22938

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    long long x1,y1,r1;
    cin >> x1 >> y1 >> r1;
    long long x2,y2,r2;
    cin >> x2 >> y2 >> r2;

    long long d = sqrt(pow((x1-x2),2)+pow((y1-y2),2));

    if(d<r1+r2){
        cout<<"YES";
    }
    else {
        cout<<"NO";
    }
    
    return 0;
}

 이 문제 같은 경우는 여러번 틀려서 정말 멘붕이 되었는데 그 이유가 NO인데 내가 No라고 출력을 설정해두었기 때문이었다... 

#22966

#include <iostream>
#include <string>
using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n,t;
    cin >> n;
    string s,result;

    int min =5;

    for (int i=0;i<n;i++){
       cin >> s >> t;

       if(t<min){
           min = t;
           result = s;
       }
    }

    cout << result;

    return 0;
}

#23037

#include <iostream>
#include <string>
#include <cmath>
using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    string num;
    cin >> num;
    int sum = 0;

    for(int i=0;i<num.size();i++){
        //문자로 수정하고 싶으면 -'0'
        sum += pow(num[i]-'0',5);
    }

    cout << sum;

    return 0;
}

#23234

#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cout<<"The world says hello!";

    return 0;
}

#23795

#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    int sum=0;

    while(1){
        cin >> n;
        if(n==-1){
            break;
        }
        sum += n;
    }

    cout<<sum;

    return 0;
}

#23825

#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n,m;
    cin >> n >> m;

    if(m>=n){
        cout << n/2;
    }
    else {
        cout<<m/2;
    }

    return 0;
}

#24568

#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n,m;
    cin >> n;
    cin >> m;

    int sum = 8*n + 3*m;
    cout << sum-28;

    return 0;
}

#25083

#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cout<<"         ,r'\"7\n"
          "r`-_   ,'  ,/\n"
          " \\. \". L_r'\n"
          "   `~\\/\n"
          "      |\n"
          "      |";

    return 0;
}

#25238

#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int a,b;
    cin >> a >> b;
    int sum = a - (a*(b*0.01));

    if(sum>=100){
        cout<<false;
    }
    else{
        cout<<true;
    }

    return 0;
}