KiKi非常喜欢网购,在一家店铺他看中了一件衣服,他了解到,如果今天是“双11”(11月11日)则这件衣服打7折,“双12” (12月12日)则这件衣服打8折,如果有优惠券可以额外减50元(优惠券只能在双11或双12使用),求KiKi最终所花的钱数。
数据范围:衣服价格满足 
一行,四个数字,第一个数表示小明看中的衣服价格,第二和第三个整数分别表示当天的月份、当天的日期、第四个整数表示是否有优惠券(有优惠券用1表示,无优惠券用0表示)。 注:输入日期保证只有“双11”和“双12”。
一行,小明实际花的钱数(保留两位小数)。(提示:不要指望商家倒找你钱)
1000.0 11 11 1
650.00
999.8 12 12 0
799.84
66.6 11 11 1
0.00
public static void main(String[] args) { Scanner in = new Scanner(System.in); double val = in.nextDouble(); int moon = in.nextInt(); int date = in.nextInt(); int ticket = in.nextInt(); if (moon == 11 && date == 11){ //双11 if (ticket == 1){ val = val * 0.7 - 50.0; } else { val = val * 0.7; } } else if (moon == 12 && date == 12){ //双12 if (ticket == 1){ val = val * 0.8 - 50.0; } else { val = val * 0.8; } } //不会倒找钱 if (val < 0){ val = 0; } System.out.printf("%.2f",val); }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); float price=sc.nextFloat(); int month=sc.nextInt(),day=sc.nextInt(),coupons=sc.nextInt(); if(month==11&&day==11){ price*=0.7; if(coupons==1) price-=50; }else if(month==12&&day==12){ price*=0.8; if(coupons==1) price-=50; } if(price<0) price=0; System.out.printf("%.2f",price); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while(scanner.hasNext()){ //商品价格 double goodPrice = scanner.nextDouble(); //月份 int month = scanner.nextInt(); //日期 int day = scanner.nextInt(); //优惠券 int coupons = scanner.nextInt(); //折扣后的商品价格 double discountGoodPrice = 0.0; //双11 if(month == 11 && day == 11){ if(coupons == 1){ discountGoodPrice = (goodPrice * 0.7) - 50.0; }else{ discountGoodPrice = goodPrice * 0.7; } } //双12 if(month == 12 && day == 12){ if(coupons == 1){ discountGoodPrice = (goodPrice * 0.8) - 50.0; }else{ discountGoodPrice = goodPrice * 0.8; } } //判断打折后加上使用优惠券的时候的最总价格,毕竟商家不能倒贴钱 //打折后的价格小于等于0时,相当于白送,否则按正常价格输出 if(discountGoodPrice <= 0.0){ System.out.println("0.00"); }else{ System.out.println(String.format("%.2f",discountGoodPrice)); } } } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double[] arr = new double[4]; double price = 0; for (int i = 0; i < 4; i++) { arr[i] = sc.nextDouble(); } if (arr[1] < 12) { price = 0.7 * arr[0]; } else { price = 0.8 * arr[0]; } if (arr[3] < 1) { System.out.printf("%.2f", price); } else { double m = (price - 50) > 0 ? (price - 50) : 0; System.out.printf("%.2f", m); } } }
import java.util.*; public class Main{ public static void main(String args[]){ Scanner input=new Scanner(System.in); double val=input.nextDouble(); int Mon=input.nextInt(); int day=input.nextInt(); int coupon=input.nextInt(); double result=0; if(Mon==11&&day==11){ if(coupon==1){ result=val*0.7-50; } else result=val*0.7; } else if(Mon==12&&day==12){ if(coupon==1){ result=val*0.8-50; } else result=val*0.8; } System.out.print(result>0?String.format("%.2f",result):String.format("%.2f",0.00)); } }
import java.util.Arrays; import java.util.Scanner; import java.util.stream.Collectors; /** * * @Title 网购 * @Description KiKi非常喜欢网购,在一家店铺他看中了一件衣服,他了解到, * 如果今天是“双11”(11月11日)则这件衣服打7折,“双12” (12月12日)则这件衣服打8折, * 如果有优惠券可以额外减50元(优惠券只能在双11或双12使用),求KiKi最终所花的钱数。 * 数据范围:衣服价格满足 1≤val≤100000 * 输入描述: * 一行,四个数字,第一个数表示小明看中的衣服价格,第二和第三个整数分别表示当天的月份、当天的日期、第四个整数表示是否有优惠券(有优惠券用1表示,无优惠券用0表示)。 注:输入日期保证只有“双11”和“双12”。 * 输出描述: * 一行,小明实际花的钱数(保留两位小数)。(提示:不要指望商家倒找你钱) * @author weijunfu<ijunfu @ qq.com> * @date 2022/03/16 23:44 * @version 1.0.0 * */ public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); double v = in.nextDouble(); int month = in.nextInt(); int day = in.nextInt(); int flag = in.nextInt(); double discount = month == 11 ? 0.7 : 0.8; // 折扣 int coupons = flag == 0 ? 0 : 50; // 优惠券 double consume = v * discount - coupons; System.out.printf("%.2f", consume < 0 ? 0 : consume); in.close(); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String[] str = scanner.nextLine().split(" "); double a = Double.parseDouble(str[0]); int b = Integer.parseInt(str[1]); int c = Integer.parseInt(str[2]); int d = Integer.parseInt(str[3]); double pay; if (c == 11 && b == 11) { if (d == 1) { if (a * 0.7 > 50) { pay = a * 0.7 - 50; System.out.print(String.format("%.2f", pay)); } else { System.out.print("0.00"); } } else { pay = a * 0.7; System.out.print(String.format("%.2f", pay)); } } else if (b == 12 && c == 12) { if (d == 1) { if (a * 0.8 > 50) { pay = a * 0.8 - 50; System.out.print(String.format("%.2f", pay)); } else { System.out.print("0.00"); } } else { pay = a * 0.8; System.out.print(String.format("%.2f", pay)); } } else{ System.out.print(String.format("%.2f", a)); } } }
import java.util.*; public class Main{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double price = scanner.nextDouble(); int date1 = scanner.nextInt(); int date2 = scanner.nextInt(); int n = scanner.nextInt(); if (date1==11 && date2 == 11 && n==1){ price = price * 0.7 - 50; }else if (date1==11 && date2 == 11 && n ==0){ price = price * 0.7; }else if (date1==12 && date2 == 12 && n ==1){ price = price *0.8 - 50; }else if (date1==12 && date2 == 12 && n ==0){ price = price * 0.8; } if (price <= 0){ System.out.println("0.00"); }else { System.out.printf("%.2f",price); } } }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); double price = scanner.nextDouble(); int yue = scanner.nextInt(); int ri = scanner.nextInt(); int bool = scanner.nextInt(); double sum = 0; if(yue == 11){ if(bool == 1){ sum = price * 0.7 - 50; }else{ sum = price * 0.7; } }else{ if(bool == 1){ sum = price * 0.8 - 50; }else{ sum = price * 0.8; } } if(sum <= 0.00){ System.out.printf("0.00"); }else{ System.out.printf("%.2f",sum); } } }
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String[] input = in.nextLine().split(" "); double discount; double price = Double.parseDouble(input[0]); if (input[1].equals(input[2]) && input[1].equals("11")){ discount = 0.7; }else if (input[1].equals(input[2]) && input[1].equals("12")){ discount = 0.8; }else { discount = 1.0; } price = price * discount; if (input[3].equals("1")){ price -= 50.0; } if (price < 0){ price = 0.00; } System.out.printf("%.2f", price); } }
import java.util.Scanner; public class test35 { public static void main(String[] args) { double price; int month,day,count; Scanner sc1=new Scanner(System.in); while (sc1.hasNext()){ price=sc1.nextDouble(); month= sc1.nextInt(); day=sc1.nextInt(); count=sc1.nextInt(); if(month==day && day==11){ price=price*0.7; } if(month==day && day==12){ price=price*0.8; } if(count==1){ price=price-50; } if(price<0){ price=0; } System.out.printf("%.2f",price); } } }
import java.util.*; public class Main{ public static void main(String[] args){ Scanner in = new Scanner(System.in); double price = in.nextDouble(); int month = in.nextInt(); int day = in.nextInt(); int coupon = in.nextInt(); if(month==day&&month==12){ price = price*0.8; } if(month==day&&month==11){ price = price*0.7; } if(coupon==1){ price = price - 50; } System.out.printf("%.2f",price>0?price:0.0); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str[] = sc.nextLine().split(" "); if(str[1].equals("11")&&str[2].equals("11")){ double money = Double.parseDouble(str[0]); double realmoney = money*0.7; if(str[3].equals("1")){ realmoney = realmoney - 50; if(realmoney<0){ realmoney = 0; } } System.out.printf("%.2f",realmoney); } else if(str[1].equals("12")&&str[2].equals("12")){ double money = Double.parseDouble(str[0]); double realmoney = money*0.8; if(str[3].equals("1")){ realmoney = realmoney - 50; if(realmoney<0){ realmoney = 0; } } System.out.printf("%.2f",realmoney); } else{ double money = Double.parseDouble(str[0]); double realmoney = money; System.out.printf("%.2f",realmoney); } } }
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
double price=input.nextDouble();
int mm=input.nextInt();
int dd=input.nextInt();
int flag=input.nextInt();
if(mm==11&&dd==11) price*=0.7;
else if(mm==12&&dd==12) price*=0.8;
if(flag==1)price-=50;
price=price<0?0:price;
System.out.println(String.format("%.2f",price));
}
}