<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>개발 블로그</title>
    <description>GODMOONL의 개발 블로그 및 포트폴리오 블로그입니다.
</description>
    <link>https://godmoonl.github.io/</link>
    <atom:link href="https://godmoonl.github.io/rss" rel="self" type="application/rss+xml"/>
    <pubDate>Mon, 25 Oct 2021 16:33:04 +0900</pubDate>
    <lastBuildDate>Mon, 25 Oct 2021 16:33:04 +0900</lastBuildDate>
    <generator>Jekyll v3.9.0</generator>
    
      <item>
        <title>~20년 1월 목표</title>
        <description>&lt;h2 id=&quot;이룰-것&quot;&gt;이룰 것&lt;/h2&gt;
&lt;blockquote&gt;
  &lt;p&gt;BOJ 랭킹 500등
Discord Bot 프로젝트 
Tensorflow를 이용한 &amp;lt;목표 관리, 예측 시스템&amp;gt;(가칭) 프로젝트
다익스트라 같은 알고리즘 공부하기&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;지금-해야할-것&quot;&gt;지금 해야할 것&lt;/h2&gt;
&lt;blockquote&gt;
  &lt;p&gt;하루에 BOJ 문제 1개씩 풀기
DP,탐색문제 푼것도 다시 풀어보기
Tensorflow 익히기
1일 1커밋&lt;/p&gt;
&lt;/blockquote&gt;

</description>
        <pubDate>Thu, 05 Dec 2019 00:00:00 +0900</pubDate>
        <link>https://godmoonl.github.io/2019/12/05/0001/</link>
        <guid isPermaLink="true">https://godmoonl.github.io/2019/12/05/0001/</guid>
        
        
      </item>
    
      <item>
        <title>백준 1788번 피보나치 수의 확장 풀이</title>
        <description>&lt;h2 id=&quot;문제-풀이-방법&quot;&gt;문제 풀이 방법&lt;/h2&gt;

&lt;p&gt;이 문제는 &lt;strong&gt;$F(n)$을 1000000000으로 나눈 나머지를 출력하면 되는 문제이기 때문&lt;/strong&gt;에,
 문자열로 할 필요없이 그냥 &lt;strong&gt;for문으로 해결할 수 있는 문제&lt;/strong&gt;이다.&lt;/p&gt;

&lt;p&gt;간단하게 for문 2개로 &lt;strong&gt;음수일때, 음수가 아닐때를 따져보면서 풀어보면 된다.&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;피보나치-수열-점화식&quot;&gt;피보나치 수열 점화식&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;$n$이 음수일때의 피보나치 수열의 점화식은 $F(n) = F(n-2) - F(n-1)$&lt;/strong&gt;으로 점화식을 새울 수 있다.&lt;/p&gt;

&lt;p&gt;그래서 for문으로 다음과 같이 작성할 수 있다.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; for (int i = 2; i &amp;lt;= abs(n); i++) {
			a[i] = a[i - 2] - a[i - 1];
			a[i] %= 1000000000;//long long 범위를 넘는 것을 방지하기 위해 처음부터 1000000000으로 나눔 
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;$n$이 자연수일때는 $F(n) =  F(n-1) + F(n-2)$&lt;/strong&gt;으로 점화식을 새울 수 있다.&lt;/p&gt;

&lt;p&gt;이 또한 for문으로 다음과 같이 작성할 수 있다.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; for (int i = 2; i &amp;lt;= n; i++) {
			a[i] = a[i - 1] + a[i - 2];
			a[i] %= 1000000000;//long long 범위를 넘는 것을 방지하기 위해 처음부터 1000000000으로 나눔 
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;코드&quot;&gt;코드&lt;/h1&gt;

&lt;h2 id=&quot;c&quot;&gt;C&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;math.h&amp;gt;
using namespace std;
long long a[1000001], n;
int main() {
	scanf(&quot;%d&quot;,&amp;amp;n);
	a[0] = 0;
	a[1] = 1;
	if (n &amp;lt; 0) {
		for (int i = 2; i &amp;lt;= abs(n); i++) {
			a[i] = a[i - 2] - a[i - 1];
			a[i] %= 1000000000;
		}
		if (a[abs(n)]&amp;lt;0)printf(&quot;-1\n&quot;);
## 		else printf(&quot;1\n&quot;);
		printf(&quot;%lld&quot;,abs(a[abs(n)]) % 1000000000);
	}
	else if (n &amp;gt; 0) {
		for (int i = 2; i &amp;lt;= n; i++) {
			a[i] = a[i - 1] + a[i - 2];
			a[i] %= 1000000000;
		}
		printf(&quot;%lld&quot;,a[n] % 1000000000);
	}
	else printf(&quot;0\n0&quot;);

	return 0;
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;c-1&quot;&gt;C++&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;math.h&amp;gt;
using namespace std;
long long a[1000001], n;
int main() {
	cin &amp;gt;&amp;gt; n;
	a[0] = 0;
	a[1] = 1;
	if (n &amp;lt; 0) {
		for (int i = 2; i &amp;lt;= abs(n); i++) {
			a[i] = a[i - 2] - a[i - 1];
			a[i] %= 1000000000;
		}
		if (a[abs(n)]&amp;lt;0)cout &amp;lt;&amp;lt; &quot;-1&quot; &amp;lt;&amp;lt; &quot;\n&quot;;
		else cout &amp;lt;&amp;lt; &quot;1&quot; &amp;lt;&amp;lt; &quot;\n&quot;;
		cout &amp;lt;&amp;lt; abs(a[abs(n)]) % 1000000000;
	}
	else if (n &amp;gt; 0) {
		for (int i = 2; i &amp;lt;= n; i++) {
			a[i] = a[i - 1] + a[i - 2];
			a[i] %= 1000000000;
		}
		cout &amp;lt;&amp;lt; &quot;1&quot; &amp;lt;&amp;lt; &quot;\n&quot; &amp;lt;&amp;lt; a[n] % 1000000000;
	}
	else cout &amp;lt;&amp;lt; &quot;0&quot; &amp;lt;&amp;lt; &quot;\n&quot; &amp;lt;&amp;lt; &quot;0&quot;;

	return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;다른-언어&quot;&gt;다른 언어&lt;/h2&gt;

&lt;p&gt;다른 언어도 &lt;strong&gt;음수일때, 양수일때를 나눠 가며 
각각  $F(n) = F(n-2) - F(n-1)$, $F(n) = F(n-1) + F(n-2)$ 점화식에 맞게 풀면 된다.&lt;/strong&gt;&lt;/p&gt;

</description>
        <pubDate>Sun, 21 Apr 2019 00:00:00 +0900</pubDate>
        <link>https://godmoonl.github.io/2019/04/21/1788/</link>
        <guid isPermaLink="true">https://godmoonl.github.io/2019/04/21/1788/</guid>
        
        
      </item>
    
  </channel>
</rss>
