20151021


*이문제는 + 연산자와 - 연사자를 알고 있어야 합니다.
*이문제는 dovelet 에 있는 알고리즘 문제입니다.





논문인용/coci_faktor




프로그램 명: coci_faktor

제한시간: 1 초


[문제요약] 과학 논문 평가의 주요 요소는 다른 논문에 얼마나 많은 인용이 일어나는가가 주요 요소이다.

만약 38 개의 논문에 894 번의 인용이 일어났다면

  • 평가 점수는 894/38 = 23.53
  • 올림하면 24 이다.(항상 올림)

y 개의 논문에 x 번의 인용이 일어난 경우 주요 요소 z 를 구할 수 있다. 문제는 y , z 가 주어질 때 최소 x 를 구하는 것이다.


Impact factor of a scientific journal is a measure reflecting the average number of citations to articles published in science journals. For this task we are using a simplified formula for calculating the impact factor:

Total sum of all citations articles published in the journal recived
--------------------------------------------------------------------
              Total number of articles published

Rounding is always preformed up. For example the impact factor of the “Journal for ore research and time wasting” that published 38 articles quoted 894 times is 894 / 38 = 23.53 rounding up to 24.

You are the editor of one scientific journal. You know how much article you are going to publish and the owners are pushing you to reach a specific impact factor. You are wondering how many scientists you will have to bribe to cite your article to meet the owners demands. Since money is tight you want to bribe the minimal amount of scientists.

입력

First and only line of input will contain 2 integers, A (1 ≤ A ≤ 100), number of articles you plan to publish and I (1 ≤ I ≤ 100) impact factor the owners require.

출력

First and only line of output should contain one integer, the minimal number of scientists you need to bribe.

입출력 예

input

38 24

output

875

input

1 100

output

100

input

10 10

output

91
출처:COCI 2009/2010 contest2 1/6





제 풀이



1) 풀이

import java.io.PrintStream;
import java.util.Scanner;

public class Main {
 
	Scanner sc = new Scanner(System.in);
	PrintStream p = System.out;
	int y, z;

	public static void main(String[] args) {
		Main ma = new Main();
	    ma.input();
	    ma.result();
	}
	void input(){
		y = sc.nextInt();   
		z = sc.nextInt(); 	
	}
	void result(){
		p.println((y*z)-(y-1));
	}
}





*짧게 코딩하는것도 좋지만 저는 함수와 객체 지향개념을 쓰고 싶어서 이렇게 코딩 했습니다.


수식으로 표현하면 X(인용)/Y(논문) = Z(주요 요소) 입니다. 그런데 Y(논문) , Z(주요 요소) 를 알려주고 X(인용) 값이 미지수가 됩니다. 수식으로 풀면 x = z*y 가 됩니다. 그런데 주요 요소 값이 항상 올림으로 처리 하는 부분과 최소값을 구하라고 했습니다.


z 는 이미 올림 처리가 된 값이죠 그럼 x/y 값에서 올림 처리가 되면 z 값이 될수 있는 값중에서 최소값은  z 값에서 y 값보다 1 작은 수를 빼줘야 합니다.


예) 1의 자리중에서 올림이 되어지는 최소 값은 1 입니다. 0->올림 0,  1-> 올림 10

x 값이 20 이고 y 값이 10 이면 (20/10) x 값에 -9 를 해줘야 11/10 -> 1.1 이 값이 올림 했을때 2가 될 수 있는 최소 값 입니다.


혹시 이해가 안가시면 뎃글 남겨주세요 ㅎ



+ Recent posts