头像

张立斌


访客:16098

离线:5天前


活动打卡代码 AcWing 612. 球的体积

张立斌
3个月前
#include <iostream>
static constexpr double kPI = 3.14159;
int main(void) {
    int r;
    scanf("%d", &r);
    const double volume = (4/3.0) * kPI * r * r * r;
    printf("VOLUME = %.3lf", volume);
    return 0;
}


活动打卡代码 AcWing 611. 简单计算

张立斌
3个月前
#include <iostream>
struct Product {
    int number;
    int count;
    double price;
    double TotalPrice() const {
        return count * price;
    }
};
int main(void) {
    Product product0;
    scanf("%d %d %lf", &product0.number, &product0.count, &product0.price);
    Product product1;
    scanf("%d %d %lf", &product1.number, &product1.count, &product1.price);
    printf("VALOR A PAGAR: R$ %.2lf", product0.TotalPrice() + product1.TotalPrice());
    return 0;
}


活动打卡代码 AcWing 605. 简单乘积

张立斌
3个月前
#include <iostream>
int main(void) {
    int a, b;
    scanf("%d%d", &a, &b);
    printf("PROD = %d", a * b);
    return 0;
}


活动打卡代码 AcWing 654. 时间转换

张立斌
3个月前
#include <iostream>
int main(void) {
    int n;
    scanf("%d", &n);
    const int hours = n / 3600;
    n %= 3600;
    const int minutes = n / 60;
    n %= 60;
    const int seconds = n;
    printf("%d:%d:%d\n", hours, minutes, seconds);
    return 0;
}


活动打卡代码 AcWing 653. 钞票

张立斌
3个月前
#include <iostream>
int main(void) {
    const int value_arr[] = {100,50,20,10,5,2,1};
    const int value_arr_size = sizeof(value_arr) / sizeof(value_arr[0]);
    int n;
    scanf("%d", &n);
    printf("%d\n", n);
    for (int index=0; index < value_arr_size; ++index) {
        const int value = value_arr[index];
        const int cnt = n / value;
        n %= value;
        printf("%d nota(s) de R$ %d,00\n", cnt, value);
    }
    return 0;
}


活动打卡代码 AcWing 616. 两点间的距离

张立斌
3个月前
#include <cmath>
#include <iostream>
inline double Pow2(double x) {
    return x * x;
}
int main(void) {
    double x1, y1, x2, y2;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    printf("%.4lf\n", std::sqrt(Pow2(x2 - x1) + Pow2(y2 - y1)));
    return 0;
}


活动打卡代码 AcWing 615. 油耗

张立斌
3个月前
#include <iostream>
int main(void) {
    int x;
    double y;
    scanf("%d %lf", &x, &y);
    printf("%.3lf km/l", x / y);
    return 0;
}


活动打卡代码 AcWing 609. 工资

张立斌
3个月前
#include <iostream>

int main(void) {
    int number, work_time;
    double hourly_pay;
    scanf("%d %d %lf", &number, &work_time, &hourly_pay);
    printf("NUMBER = %d\nSALARY = U$ %.2lf", number, work_time * hourly_pay);
    return 0;
}


活动打卡代码 AcWing 604. 圆的面积

张立斌
3个月前
#include <iostream>

static constexpr double PI = 3.14159;

int main(void) {
    double r;
    scanf("%lf", &r);
    printf("A=%.4lf", PI * r * r);
    return 0;
}


活动打卡代码 AcWing 608. 差

张立斌
3个月前
#include <iostream>
int main(void) {
    int64_t a, b, c, d;
    scanf("%ld%ld%ld%ld", &a, &b, &c, &d);
    printf("DIFERENCA = %ld", a * b - c *d);
    return 0;
}