与‘基础算法-简单数学’有关的日志

acdream1077

maksyuki 发表于 oj 分类,标签:
0
acdream1077

Problem Description

Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.

But I also don't want to use many numbers, so I'll choose three positive integ >>继续阅读

xdu1076

maksyuki 发表于 oj 分类,标签:
0
xdu1076

1076: 小W喜欢的数字

题目描述

大家都知道,小W是一名大帅哥,当然比起Light还是有点儿差距的!帅气的小W认为0-9这些数字,只有1,3,5是完美的。

欲问小W为什么,小W总是说“帅哥,是不需要解释的”.所以在帅哥小W的世界里, >>继续阅读

xdu1029

maksyuki 发表于 oj 分类,标签:
0
xdu1029

1029: 数一的逆袭

题目描述

数一是一个穷屌丝兼程序猿,是社会受剥削的底层人物,但是他有一个梦想,就是博得女神的欢心。这天,数一的女神说:"一直活在二次元的屌丝啊,一直活在二进制的程序猿啊,你们这群二货快告诉我这堆2是怎么回事?" >>继续阅读

lightoj1369

maksyuki 发表于 oj 分类,标签:
0
lightoj1369

1369 - Answering Queries

long long f( int A[], int n ) { // n = size of AThe problem you need to solve here is pretty simple. You are give a function f(A, n), where A is an array of integers and n is the number of elements in the array. f(A, n) is >>继续阅读

lightoj1294

maksyuki 发表于 oj 分类,标签:
0
lightoj1294

1294 - Positive Negative Sign

-1 -2 -3 +4 +5 +6 -7 -8 -9 +10 +11 +12Given two integers: n and m and n is divisible by 2m, you have to write down the first n natural numbers in the following form. At first take first m integers and make their sign n >>继续阅读

lightoj1213

maksyuki 发表于 oj 分类,标签:
0
lightoj1213

1213 - Fantasy of a Summation

#include <stdio.h>If you think codes, eat codes then sometimes you may get stressed. In your dreams you may see huge codes, as I have seen once. Here is the code I saw in my dream.

int cases, caseno;

int n, K >>继续阅读

lightoj1202

maksyuki 发表于 oj 分类,标签:
0
lightoj1202

1202 - Bishops

Now you are given the position of the two bishops. You have to find the minimum chess moves to take one to another. With a chess move, a bishop can be moved to a long distance (along the diagonal lines) with just one move.There is an >>继续阅读

lightoj1116

maksyuki 发表于 oj 分类,标签:
0
lightoj1116

1116 - Ekka Dokka

They want to divide the cake such that N * M = W, where W is the dashing factor set by them. Now you know their dashing factor, you have to find whether they can buy the desired cake or not.Ekka and his friend Dokka decided to buy >>继续阅读

lightoj1078

maksyuki 发表于 oj 分类,标签:
0
lightoj1078

1078 - Integer Divisibility

For example you have to find a multiple of 3 which contains only 1's. Then the result is 3 because is 111 (3-digit) divisible by 3. Similarly if you are finding some multiple of 7 which contains only 3's then, the result >>继续阅读

lightoj1045

maksyuki 发表于 oj 分类,标签:
0
lightoj1045

1045 - Digits of Factorial

f(0) = 1 f(n) = f(n - 1) * n, if(n > 0)Factorial of an integer is defined by the following function

So, factorial of 5 is 120. But in different bases, the factorial may be different. For example, factorial of 5 in ba >>继续阅读

lightoj1042

maksyuki 发表于 oj 分类,标签:
0
lightoj1042

1042 - Secret Origins

But we do know the story of the first time she set out to chart her own path in the time stream. Zephyr had just finished building her time machine which she named - "Dokhina Batash". She was making the final adjustments for h >>继续阅读

lightoj1010

maksyuki 发表于 oj 分类,标签:
0
lightoj1010

1010 - Knights in Chessboard

Those who are not familiar with chess knights, note that a chess knight can attack 8 positions in the board as shown in the picture below.Given an m x n chessboard where you want to place chess knights. You have to find >>继续阅读

lightoj1008

maksyuki 发表于 oj 分类,标签:
0
lightoj1008

1008 - Fibsieve`s Fantabulous Birthday

Among these gifts there was an N x N glass chessboard that had a light in each of its cells. When the board was turned on a distinct cell would light up every second, and then go dark.Fibsieve had a fantabulou >>继续阅读

sgu105

maksyuki 发表于 oj 分类,标签:
0
sgu105

Div 3

There is sequence 1, 12, 123, 1234, ..., 12345678910, ... . Given first N elements of that sequence. You must determine amount of numbers in it that are divisible by 3.

Input

Input contains N (1<=N<=231 - 1).

Output

Write >>继续阅读