关于OJ1028的参考解法
其中运用了最小公倍数与最大公约数乘积等于两数相乘的定理。
#include <stdio.h>
int main(int argc, char *argv[])
{
int a,b,c,d,e;
scanf("%d %d",&a,&b);
d=a*b;
while(b>)
{
c=a%b;
a=b;
b=c;
}
e=d/a;
printf("%d\n",e);
return ;
}
关于OJ1028的参考解法的更多相关文章
- 关于欧几里得算法求最大公约数,即OJ1029的参考解法
#include <stdio.h> int main(int argc, char *argv[]) { int a,b,c; scanf("%d %d",& ...
- Codeforces Round #380 (Div. 2) 解题报告
第一次全程参加的CF比赛(虽然过了D题之后就开始干别的去了),人生第一次codeforces上分--(或许之前的比赛如果都参加全程也不会那么惨吧),终于回到了specialist的行列,感动~.虽然最 ...
- leetcode Database3(Nth Highest Salary<—>Consecutive Numbers<—>Department Highest Salary)
一.Nth Highest Salary Write a SQL query to get the nth highest salary from the Employee table. +----+ ...
- leetcode:Lowest Common Ancestor of a Binary Search Tree
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...
- leetcode:House Robber(动态规划dp1)
You are a professional robber planning to rob houses along a street. Each house has a certain amount ...
- leetcode:Isomorphic Strings
Isomorphic Strings Given two strings s and t, determine if they are isomorphic. Two strings are isom ...
- 【leetcode-66】 加一
给定一个由整数组成的非空数组所表示的非负整数,在该数的基础上加一. 最高位数字存放在数组的首位, 数组中每个元素只存储一个数字. 你可以假设除了整数 0 之外,这个整数不会以零开头. 示例 1: 输入 ...
- 【leetcode-71】 简化路径
(1 pass) 以 Unix 风格给出一个文件的绝对路径,你需要简化它.或者换句话说,将其转换为规范路径. 在 Unix 风格的文件系统中,一个点(.)表示当前目录本身:此外,两个点 (..) 表示 ...
- 【leetcode-73】 矩阵置零
给定一个 m x n 的矩阵,如果一个元素为 0,则将其所在行和列的所有元素都设为 0.请使用原地算法. 示例 1: 输入: [ [1,1,1], [1,0,1], [1,1,1] ] 输 ...
随机推荐
- 测试内容url
nscurl --ats-diagnostics https://xxxx/xxxx/main/ curl "https://app.api.gupiaoxianji.com/v3.8/ma ...
- AOP programming paradiag
AOP https://en.wikipedia.org/wiki/Aspect-oriented_programming Typically, an aspect is scattered or t ...
- redhat note
1,iptables -I INPUT 5 -m state --state NEW -p tcp --dport 80 -j ACCEPT
- Leetcode: Heaters
Winter is coming! Your first job during the contest is to design a standard heater with fixed warm r ...
- 基于Yahoo网站性能优化的34条军规及自己的见解
1.尽量减少HTTP请求次数 终端用户响应的时间中,有80%用于下载各项内容,这部分时间包括下载页面中的图像.样式表.脚本.Flash等.通过减少页面中的元素可以减少HTTP请求的次数,这是提高网页速 ...
- Tomcat 常用配置及网站部署
一.同一Tomcat 多个端口部署不同的项目 在tomcat 安装目录下C:/Program Files/apache-tomcat-6.0.29/conf找到server.xml (1 ...
- android 断点下载---XUtils
配置权限 <uses-permission android:name="android.permission.INTERNET"/> <uses-permissi ...
- SQL 递归
-- 查询指定部门下面的所有部门, 并汇总各部门的下级部门数 ) SET @Dept_name = N'MIS' ;WITH DEPTS AS( -- 查询指定部门及其下的所有子部门 -- 定位点成员 ...
- 通达信5分钟.lc5和.lc1文件格式
一.通达信日线*.day文件 文件名即股票代码 每32个字节为一天数据 每4个字节为一个字段,每个字段内低字节在前 00 ~ 03 字节:年月日, 整型 04 ~ 07 ...
- Oracle RAC安装部署文档
1. 部署环境步骤 1.1 软件环境 操作系统:CentOS release 6.5(推荐使用5.*的系统)192.168.1.151 racnode1 192.168.1.152 ...