关于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] ] 输 ...
随机推荐
- 微信小程序开发POST请求
onLoad: function() { that = this; wx.request( { url: "http://op.juhe.cn/onebox/weather/query&qu ...
- Python开发【前端】:HTML
HTML HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言(标记).相当于定义统一的一套规则,大家都来遵守他,这样就可以让浏 ...
- shell中对字符串的处理
1.替换字符串1为字符串2 sed "s/str1/str2/g" 2.获取字符串中的一部分 例:boke-blade 取得boke:sed -e "s/-.*//g&q ...
- Quartz 入门详解
Quartz是OpenSymphony开源组织在Job scheduling领域又一个开源项目,它可以与J2EE与J2SE应用程序相结合也可以单独使用.Quartz可以用来创建简单或为运行十个,百个, ...
- windows下搭建nginx+php+mysql环境
一.下载需要的东西 1.nginx:http://nginx.org/en/download.html 2.php:http://php.net/downloads.php 3.mysql:(暂时先不 ...
- MonkeyTest简单实用介绍
什么是Monkeytest? monkey测试是Android平台自动化测试的一种手段,通过Monkey程序模拟用户触摸屏幕.滑动Trackball.按键灯操作来对设备上的程序进行压力测试,检测程序发 ...
- 第一部分:连接MYSQL数据库代码
<?php $connec=mysql_connect("localhost","root","root") or die(" ...
- Keras学习~第一个例子~跑MNIST
import numpy as npimport gzip import struct import keras as ks import logging from keras.layers impo ...
- IP釋放、清除、以及刷新DNS
Windows 10 於桌面按住 Windows + X 按鍵. 選擇 Command Prompt (以管理員執行). 在彈跳視窗中輸入 ipconfig /release. 等待數秒回報此 IP ...
- charles 之 ssl proxy 设置(https抓包)
PC端设置 1.启动Charles软件,在菜单中找到 Help -> SSL Proxying ->Install Charles Root Certificate. 2.菜单中找到 pr ...