头像

布丁奶茶




离线:1天前


最近来访(23)
用户头像
self-discipline_36
用户头像
zsfz彭文迪
用户头像
天元之弈
用户头像
Steph
用户头像
恶魔波刚
用户头像
淡淡的浅梦
用户头像
万能的老王
用户头像
蓝色的天空
用户头像
melted995
用户头像
sourcedream
用户头像
Coffees
用户头像
小会儿来敲代码了
用户头像
_ddl
用户头像
问潮汐
用户头像
李.嘉图
用户头像
想起个网名
用户头像
Arukas


Java代码

/*零食种类        价格
零食  1         R$ 4.00
零食  2         R$ 4.50
零食  3         R$ 5.00
零食  4         R$ 2.00
零食  5         R$ 1.50*/
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), y = sc.nextInt();
        double total, money = 0;
        if(x == 1)  money = 4;
        else if(x == 2) money = 4.5;
        else if(x == 3) money = 5;
        else if(x == 4) money = 2;
        else if(x == 5) money = 1.5;
        total = money * y;
        System.out.printf("Total: R$ %.2f", total);
    }
}

Python代码

x, y = map(int,input().split())
if x == 1:
    money = 4.0
elif x == 2:
    money = 4.5
elif x == 3:
    money = 5.0
elif x == 4:
    money = 2.0
elif x == 5:
    money = 1.5
total = money * y
print("Total: R$ %.2f" % total)

C++代码

#include<iostream>

using namespace std;

int main()
{
    int x, y;
    double total, money;
    cin >> x >> y;

    if(x == 1) money = 4;
    if(x == 2) money = 4.5;
    if(x == 3) money = 5;
    if(x == 4) money = 2;
    if(x == 5) money = 1.5;

    total = money * y;
    printf("Total: R$ %.2lf", total);
    return 0;
}


活动打卡代码 AcWing 660. 零食

Java代码

/*零食种类        价格
零食  1         R$ 4.00
零食  2         R$ 4.50
零食  3         R$ 5.00
零食  4         R$ 2.00
零食  5         R$ 1.50*/
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), y = sc.nextInt();
        double total, money = 0;
        if(x == 1)  money = 4;
        else if(x == 2) money = 4.5;
        else if(x == 3) money = 5;
        else if(x == 4) money = 2;
        else if(x == 5) money = 1.5;
        total = money * y;
        System.out.printf("Total: R$ %.2f", total);
    }
}

Python代码

x, y = map(int,input().split())
if x == 1:
    money = 4.0
elif x == 2:
    money = 4.5
elif x == 3:
    money = 5.0
elif x == 4:
    money = 2.0
elif x == 5:
    money = 1.5
total = money * y
print("Total: R$ %.2f" % total)

C++代码

#include<iostream>

using namespace std;

int main()
{
    int x, y;
    double total, money;
    cin >> x >> y;

    if(x == 1) money = 4;
    if(x == 2) money = 4.5;
    if(x == 3) money = 5;
    if(x == 4) money = 2;
    if(x == 5) money = 1.5;

    total = money * y;
    printf("Total: R$ %.2lf", total);
    return 0;
}



Java代码

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        int max, min;
        if(a > b)
        {
            max = a;
            min = b;
        }
        else
        {
            max = b;
            min = a;
        }
        if(max % min == 0)  System.out.printf("Sao Multiplos");
        else    System.out.printf("Nao sao Multiplos");
    }
}

Python代码

a, b = map(int,input().split())
if a > b:
    max = a
    min = b
else:
    max = b
    min = a
if max % min == 0:
    print("Sao Multiplos")
else:
    print("Nao sao Multiplos")

C++代码

#include<iostream>

using namespace std;

int main()
{
    int a, b, max, min;
    cin >> a >> b;
    if(a > b)
    {
        max = a;
        min = b;
    }
    else
    {
        max = b;
        min = a;
    }
    if(max % min == 0)
    {
        printf("Sao Multiplos");
    }
    else
    {
        printf("Nao sao Multiplos");
    }
    return 0;
}


活动打卡代码 AcWing 665. 倍数

Java代码

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        int max, min;
        if(a > b)
        {
            max = a;
            min = b;
        }
        else
        {
            max = b;
            min = a;
        }
        if(max % min == 0)  System.out.printf("Sao Multiplos");
        else    System.out.printf("Nao sao Multiplos");
    }
}

Python代码

a, b = map(int,input().split())
if a > b:
    max = a
    min = b
else:
    max = b
    min = a
if max % min == 0:
    print("Sao Multiplos")
else:
    print("Nao sao Multiplos")

C++代码

#include<iostream>

using namespace std;

int main()
{
    int a, b, max, min;
    cin >> a >> b;
    if(a > b)
    {
        max = a;
        min = b;
    }
    else
    {
        max = b;
        min = a;
    }
    if(max % min == 0)
    {
        printf("Sao Multiplos");
    }
    else
    {
        printf("Nao sao Multiplos");
    }
    return 0;
}



Java代码

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int year, mon, day;
        year = N / 365;
        N %= 365;
        mon = N / 30;
        N %= 30;
        System.out.printf("%d ano(s)\n", year);
        System.out.printf("%d mes(es)\n", mon);
        System.out.printf("%d dia(s)\n", N);
    }
}

Python代码

N = int(input())
year = N / 365
N = N % 365
mon = N / 30
N = N % 30
print("%d ano(s)" % year)
print("%d mes(es)" % mon)
print("%d dia(s)" % N)

C++代码

#include<iostream>

using namespace std;

int main()
{
    int N, year, mon;
    cin >> N;

    year = N / 365;
    N %= 365;
    mon = N / 30;
    N %= 30;
    printf("%d ano(s)\n", year);
    printf("%d mes(es)\n", mon);
    printf("%d dia(s)\n", N);
    return 0;
}


活动打卡代码 AcWing 655. 天数转换

Java代码

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int year, mon, day;
        year = N / 365;
        N %= 365;
        mon = N / 30;
        N %= 30;
        System.out.printf("%d ano(s)\n", year);
        System.out.printf("%d mes(es)\n", mon);
        System.out.printf("%d dia(s)\n", N);
    }
}

Python代码

N = int(input())
year = N / 365
N = N % 365
mon = N / 30
N = N % 30
print("%d ano(s)" % year)
print("%d mes(es)" % mon)
print("%d dia(s)" % N)

C++代码

#include<iostream>

using namespace std;

int main()
{
    int N, year, mon;
    cin >> N;

    year = N / 365;
    N %= 365;
    mon = N / 30;
    N %= 30;
    printf("%d ano(s)\n", year);
    printf("%d mes(es)\n", mon);
    printf("%d dia(s)\n", N);
    return 0;
}



java代码

//为了防止出现,n应该等于1,但是n = 0.9999999…,(double的精度问题) 所以可以上来就加上一个很小的数
//                  n += 1e-8
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double money = sc.nextDouble();
        money += 1e-8;

        System.out.printf("NOTAS:\n");
        int count = (int)money / 100;
        System.out.printf("%d nota(s) de R$ 100.00\n", count);
        money -= count * 100;
        count = (int)(money / 50);
        System.out.printf("%d nota(s) de R$ 50.00\n", count);
        money -= count * 50;
        count = (int)(money / 20);
        System.out.printf("%d nota(s) de R$ 20.00\n", count);
        money -= count * 20;
        count = (int)(money / 10);
        System.out.printf("%d nota(s) de R$ 10.00\n", count);
        money -= count * 10;
        count = (int)(money / 5);
        System.out.printf("%d nota(s) de R$ 5.00\n", count);
        money -= count * 5;
        count = (int)(money / 2);
        System.out.printf("%d nota(s) de R$ 2.00\n", count);
        money -= count * 2;

        System.out.printf("MOEDAS:\n");
        count = (int)(money / 1);
        System.out.printf("%d moeda(s) de R$ 1.00\n", count);
        money -= count * 1;
        count = (int)(money / 0.5);
        System.out.printf("%d moeda(s) de R$ 0.50\n", count);
        money -= count * 0.5;
        count = (int)(money / 0.25);
        System.out.printf("%d moeda(s) de R$ 0.25\n", count);
        money -= count * 0.25;
        count = (int)(money / 0.1);
        System.out.printf("%d moeda(s) de R$ 0.10\n", count);
        money -= count * 0.1;
        count = (int)(money / 0.05);
        System.out.printf("%d moeda(s) de R$ 0.05\n", count);
        money -= count * 0.05;
        count = (int)(money / 0.01);
        System.out.printf("%d moeda(s) de R$ 0.01\n", count);
        money -= count * 0.01;
    }
}

Python代码

money = float(input())
money += 1e-8

print("NOTAS:")
count = int(money / 100)
print("%d nota(s) de R$ 100.00" % count)
money -= count * 100;
count = int(money / 50)
print("%d nota(s) de R$ 50.00" % count)
money -= count * 50
count = int(money / 20)
print("%d nota(s) de R$ 20.00" % count)
money -= count * 20
count = int(money / 10)
print("%d nota(s) de R$ 10.00" % count)
money -= count * 10
count = int(money / 5)
print("%d nota(s) de R$ 5.00" % count)
money -= count * 5
count = int(money / 2)
print("%d nota(s) de R$ 2.00" % count)
money -= count * 2

print("MOEDAS:")
count = int(money / 1)
print("%d moeda(s) de R$ 1.00" % count)
money -= count * 1
count = int(money / 0.5)
print("%d moeda(s) de R$ 0.50" % count)
money -= count * 0.5
count = int(money / 0.25)
print("%d moeda(s) de R$ 0.25" % count)
money -= count * 0.25
count = int(money / 0.1)
print("%d moeda(s) de R$ 0.10" % count)
money -= count * 0.1
count = int(money / 0.05)
print("%d moeda(s) de R$ 0.05" % count)
money -= count * 0.05
count = int(money / 0.01)
print("%d moeda(s) de R$ 0.01" % count)
money -= count * 0.01

C++代码

#include<iostream>

using namespace std;

int main()
{
    double money;
    int count;
    cin >> money;
    money += 1e-8;

    cout << "NOTAS:" << endl;
    count = (int)(money / 100);
    printf("%d nota(s) de R$ 100.00\n", count);
    money -= count * 100;
    count = (int)(money / 50);
    printf("%d nota(s) de R$ 50.00\n", count);
    money -= count * 50;
    count = (int)(money / 20);
    printf("%d nota(s) de R$ 20.00\n", count);
    money -= count * 20;
    count = (int)(money / 10);
    printf("%d nota(s) de R$ 10.00\n", count);
    money -= count * 10;
    count = (int)(money / 5);
    printf("%d nota(s) de R$ 5.00\n", count);
    money -= count * 5;
    count = (int)(money / 2);
    printf("%d nota(s) de R$ 2.00\n", count);
    money -= count * 2;

    cout << "MOEDAS:" << endl;
    count = (int)(money / 1);
    printf("%d moeda(s) de R$ 1.00\n", count);
    money -= count * 1;
    count = (int)(money / 0.5);
    printf("%d moeda(s) de R$ 0.50\n", count);
    money -= count * 0.5;
    count = (int)(money / 0.25);
    printf("%d moeda(s) de R$ 0.25\n", count);
    money -= count * 0.25;
    count = (int)(money / 0.1);
    printf("%d moeda(s) de R$ 0.10\n", count);
    money -= count * 0.1;
    count = (int)(money / 0.05);
    printf("%d moeda(s) de R$ 0.05\n", count);
    money -= count * 0.05;
    count = (int)(money / 0.01);
    printf("%d moeda(s) de R$ 0.01\n", count);
    money -= count * 0.01;
    return 0;
}



活动打卡代码 AcWing 656. 钞票和硬币

java代码

//为了防止出现,n应该等于1,但是n = 0.9999999…,(double的精度问题) 所以可以上来就加上一个很小的数
//                  n += 1e-8
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double money = sc.nextDouble();
        money += 1e-8;

        System.out.printf("NOTAS:\n");
        int count = (int)money / 100;
        System.out.printf("%d nota(s) de R$ 100.00\n", count);
        money -= count * 100;
        count = (int)(money / 50);
        System.out.printf("%d nota(s) de R$ 50.00\n", count);
        money -= count * 50;
        count = (int)(money / 20);
        System.out.printf("%d nota(s) de R$ 20.00\n", count);
        money -= count * 20;
        count = (int)(money / 10);
        System.out.printf("%d nota(s) de R$ 10.00\n", count);
        money -= count * 10;
        count = (int)(money / 5);
        System.out.printf("%d nota(s) de R$ 5.00\n", count);
        money -= count * 5;
        count = (int)(money / 2);
        System.out.printf("%d nota(s) de R$ 2.00\n", count);
        money -= count * 2;

        System.out.printf("MOEDAS:\n");
        count = (int)(money / 1);
        System.out.printf("%d moeda(s) de R$ 1.00\n", count);
        money -= count * 1;
        count = (int)(money / 0.5);
        System.out.printf("%d moeda(s) de R$ 0.50\n", count);
        money -= count * 0.5;
        count = (int)(money / 0.25);
        System.out.printf("%d moeda(s) de R$ 0.25\n", count);
        money -= count * 0.25;
        count = (int)(money / 0.1);
        System.out.printf("%d moeda(s) de R$ 0.10\n", count);
        money -= count * 0.1;
        count = (int)(money / 0.05);
        System.out.printf("%d moeda(s) de R$ 0.05\n", count);
        money -= count * 0.05;
        count = (int)(money / 0.01);
        System.out.printf("%d moeda(s) de R$ 0.01\n", count);
        money -= count * 0.01;
    }
}

Python代码

money = float(input())
money += 1e-8

print("NOTAS:")
count = int(money / 100)
print("%d nota(s) de R$ 100.00" % count)
money -= count * 100;
count = int(money / 50)
print("%d nota(s) de R$ 50.00" % count)
money -= count * 50
count = int(money / 20)
print("%d nota(s) de R$ 20.00" % count)
money -= count * 20
count = int(money / 10)
print("%d nota(s) de R$ 10.00" % count)
money -= count * 10
count = int(money / 5)
print("%d nota(s) de R$ 5.00" % count)
money -= count * 5
count = int(money / 2)
print("%d nota(s) de R$ 2.00" % count)
money -= count * 2

print("MOEDAS:")
count = int(money / 1)
print("%d moeda(s) de R$ 1.00" % count)
money -= count * 1
count = int(money / 0.5)
print("%d moeda(s) de R$ 0.50" % count)
money -= count * 0.5
count = int(money / 0.25)
print("%d moeda(s) de R$ 0.25" % count)
money -= count * 0.25
count = int(money / 0.1)
print("%d moeda(s) de R$ 0.10" % count)
money -= count * 0.1
count = int(money / 0.05)
print("%d moeda(s) de R$ 0.05" % count)
money -= count * 0.05
count = int(money / 0.01)
print("%d moeda(s) de R$ 0.01" % count)
money -= count * 0.01

C++代码

#include<iostream>

using namespace std;

int main()
{
    double money;
    int count;
    cin >> money;
    money += 1e-8;

    cout << "NOTAS:" << endl;
    count = (int)(money / 100);
    printf("%d nota(s) de R$ 100.00\n", count);
    money -= count * 100;
    count = (int)(money / 50);
    printf("%d nota(s) de R$ 50.00\n", count);
    money -= count * 50;
    count = (int)(money / 20);
    printf("%d nota(s) de R$ 20.00\n", count);
    money -= count * 20;
    count = (int)(money / 10);
    printf("%d nota(s) de R$ 10.00\n", count);
    money -= count * 10;
    count = (int)(money / 5);
    printf("%d nota(s) de R$ 5.00\n", count);
    money -= count * 5;
    count = (int)(money / 2);
    printf("%d nota(s) de R$ 2.00\n", count);
    money -= count * 2;

    cout << "MOEDAS:" << endl;
    count = (int)(money / 1);
    printf("%d moeda(s) de R$ 1.00\n", count);
    money -= count * 1;
    count = (int)(money / 0.5);
    printf("%d moeda(s) de R$ 0.50\n", count);
    money -= count * 0.5;
    count = (int)(money / 0.25);
    printf("%d moeda(s) de R$ 0.25\n", count);
    money -= count * 0.25;
    count = (int)(money / 0.1);
    printf("%d moeda(s) de R$ 0.10\n", count);
    money -= count * 0.1;
    count = (int)(money / 0.05);
    printf("%d moeda(s) de R$ 0.05\n", count);
    money -= count * 0.05;
    count = (int)(money / 0.01);
    printf("%d moeda(s) de R$ 0.01\n", count);
    money -= count * 0.01;
    return 0;
}




Java代码

//int 的最大范围是 2 的 31 次方 2.1e9  直接相乘int会爆(hour * speed) 
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int hour = sc.nextInt(), speed = sc.nextInt();
        double total = (double)hour * speed / 12;
        System.out.printf("%.3f",total);
    }
}

Python代码

hour = int(input())
speed = int(input())
total = hour * speed / 12
print("%.3f" % total)

C++代码

#include<iostream>

using namespace std;

int main()
{
    int hour, speed;
    double total;
    cin >> hour >> speed;

    total = (double)hour * speed / 12;
    printf("%.3lf", total);
    return 0;
}


活动打卡代码 AcWing 618. 燃料消耗

Java代码

//int 的最大范围是 2 的 31 次方 2.1e9  直接相乘int会爆(hour * speed) 
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int hour = sc.nextInt(), speed = sc.nextInt();
        double total = (double)hour * speed / 12;
        System.out.printf("%.3f",total);
    }
}

Python代码

hour = int(input())
speed = int(input())
total = hour * speed / 12
print("%.3f" % total)

C++代码

#include<iostream>

using namespace std;

int main()
{
    int hour, speed;
    double total;
    cin >> hour >> speed;

    total = (double)hour * speed / 12;
    printf("%.3lf", total);
    return 0;
}