codeforces 148A(Insomnia cure) Java
来源:互联网 发布:动态矩阵控制 编辑:程序博客网 时间:2024/06/05 23:53
完成工作后,秒一波水题!!!
import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.IOException;import java.io.InputStreamReader;import java.io.OutputStreamWriter;import java.io.PrintWriter;import java.io.StreamTokenizer;/** * 题意:输入k,l,m,n,d(d代表龙的总数)。满足k,l,m,n倍数的恐龙将被消灭。问你最多能消灭几只龙? */public class Main { public static void main(String[] args) throws IOException { StreamTokenizer in = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(System.out))); int k; int l; int m; int n; int d; // 龙的总数 int ans; // 不会被消灭的龙的数量 while (in.nextToken() != StreamTokenizer.TT_EOF) { k = (int) in.nval; in.nextToken(); l = (int) in.nval; in.nextToken(); m = (int) in.nval; in.nextToken(); n = (int) in.nval; in.nextToken(); d = (int) in.nval; ans = 0; for (int lo = 1; lo <= d; lo++) { if (lo % k != 0 && lo % l != 0 && lo % m != 0 && lo % n != 0) { ans++; } } out.println(d - ans); } out.flush(); }}
阅读全文
0 0
- codeforces 148A(Insomnia cure) Java
- [Codeforces] 148A - Insomnia cure
- CodeForces-148A-Insomnia cure
- CodeForces 148A Insomnia cure
- codeforces-148A-Insomnia cure
- codeforces 148A Insomnia cure
- Problem--148A--Codeforces--A. Insomnia cure
- 148A - Insomnia cure
- 148A - Insomnia cure
- codeforce 148->A. Insomnia cure
- Insomnia cure CodeForces
- A. Insomnia cure
- CF148 A Insomnia cure
- Codeforces Round #105 (Div. 2) / 148A Insomnia cure (枚举 || 数论)
- Codeforces刷题之路——148A Insomnia cure
- CodeForce 148A Insomnia Cure 公倍数计算问题
- Insomnia cure
- Insomnia cure
- StringUtil和StringUtils的区别
- 多线程
- 爬取地名
- 01_ARM汇编自学笔记之介绍
- android代码混淆Warning:okio.DeflaterSink: can't find referenced class
- codeforces 148A(Insomnia cure) Java
- 分页控制(OC)
- javaweb经典面试题(二)
- ThinkPHP函数详解:import,vendor方法
- tensorflow全局变量初始化
- Shell脚本8种字符串截取方法总结
- 曼迪美记项目总结
- Python+OpenCV 程序暂停
- 《Attention-based LSTM for Aspect-level Sentiment Classification》阅读笔记