C++入门同步记录#5

#include<cstdio>
#include<cmath>
using namespace std;
int main() {
    int s, v;
    scanf("%d%d", &s, &v);
    int t_walk = ceil(1.0 * s / v) + 10;
    int from_zero = 60 * (24 + 8) - t_walk;
    int hh = (from_zero / 60) % 24;
    int mm = from_zero % 60;
    printf("%02d:%02d", hh, mm);
    return 0;
}


#include<cstdio>
using namespace std;
int main() {
    float a = 0.1;
    printf("%.f", int(2 - a * a * 100));
    //printf("%.10f", 2 - a * a * 100);
    return 0;
}


#include<iostream>
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    cout << (a > b) << ' ';
    cout << (a <= b) << ' ';
    cout << (a != b) << endl;
    return 0;
}


#include<iostream>
using namespace std;
int main() {
    int x; bool p1, p2;
    cin >> x;
    p1 = x % 2 == 0;
    p2 = 4 < x && x <= 12;
    cout << (p1 && p2) << ' ';
    cout << (p1 || p2) << ' ';
    cout << (p1 ^ p2) << ' ';
    cout << !(p1 || p2) << endl;
}


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

const int N = 1e5 + 5;
double a[N];

int main() {
    int t;
    cin >> t;
    while (t--){
        int n;
        int k;
        scanf("%d %d", &n, &k);
        double total = 0;
        for (int i = 0; i < n; i++){
            scanf("%lf", &a[i]);
            total += a[i];
        }
        for (int i = 0; i < n; i++){
            double e = a[i] + (a[i] * 1.0 / total * k);
            printf("%.10f ", e);
        }
        cout << endl;
    }
    return 0;
}



/*#include<iostream>
using namespace std;
int main() {
    int x; bool p1, p2, p3, p4;
    cin >> x;
    p1 = x % 4 == 0;
    p2 = x % 100 == 0;
    p3 = x % 400 == 0;
    p4 = p3 || p1 && !p2;
    cout << p4 << endl;
    return 0;
}*/
#include<iostream>
using namespace std;
int main () {
    int x; bool p;
    cin >> x;
    //p = (x % 400 == 0) || (x % 4 == 0) && !(x % 100 == 0);
    p = !(x % 400) || !(x % 4) && (x % 100);
    cout << p << endl;
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值