Sicily 4427. Greatest Common Divisors
来源:互联网 发布:沈阳网络营销黑马网络 编辑:程序博客网 时间:2024/05/18 03:00
新手赛正赛的热身题,看到时间给出5sec,觉得可能很容易超时,但数据跨度最大又只有1000,就有点弄糊涂了。最后决定暴力试下,结果居然0sec就过了,连scanf都用不上……
Run Time: 0sec
Run Memory: 312KB
Code length: 453Bytes
Submit Time: 2011-12-27 21:19:04
// Problem#: 4427// Submission#: 1138598// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/// All Copyright reserved by Informatic Lab of Sun Yat-sen University#include <iostream>using namespace std;int main(){ int T; int a, b; int low, high; int i; cin >> T; while ( T-- ) { cin >> a >> b >> low >> high; for ( i = high; i >= low; i-- ) { if ( a % i == 0 && b % i == 0 ) break; } if ( i >= low ) cout << i << endl; else cout << "No answer\n"; } return 0;}
- Sicily 4427. Greatest Common Divisors
- Sicily 4427. Greatest Common Divisors
- <Sicily>Greatest Common Divisors
- 4427. Greatest Common Divisors
- 4427. Greatest Common Divisors
- <OJ_Sicily>Greatest Common Divisors
- Greatest common divisors & Fibonacci Numbers--Algorithms
- Greatest Greatest Common Divisor
- Common Divisors
- Greatest Greatest Common Divisor HD5207
- Greatest common divisor
- The Greatest Common Divisor
- GCD (Greatest Common Divisor)
- Greatest Common Increasing Subsequence
- Solving Greatest Common Divisor
- the greatest common divisor
- 最大公约数Greatest Common Divisor
- Greatest common divider
- Effective C++读书笔记(22)
- 单精度和双精度数据
- PIL python的一个图像处理库 支持 python3
- Sicily 4379. bicoloring
- Bootstrap的一些笔记——网格系统
- Sicily 4427. Greatest Common Divisors
- Sicily 4431. 有向图边的分类
- How browsers work--Behind the scenes of modern web browsers (前端必读)
- 纠结N日谈 cpu占用率100%
- Sicily 4433. DAG?
- Sicily 4469. Find the Ball
- Sicily 4478. Walk This Way
- 谈谈对于企业级系统架构的理解
- Lazy Load(1.7.0)中文文档 -- 延迟加载图片的jQuery插件