U E D R , A S I H C RSS

1R/2016_10_06 (rev. 1.2)

1R/2016_10_06


2. 참가자

  • 15이원준
  • 박인서

3. 코드

3.1. 15이원준

3.1.1. 2×n 타일링 2

#include<iostream>
using namespace std;
 
int arr[1100] = { 0, };
int main(){
  arr[0] = 1;
  arr[1] = 1;
  int n, ans;
  cin>> n;
  for(int i = 2; i<=n; i++){
    arr[i] = (arr[i-1] + arr[i-2] * 2) % 10007;
  }
  cout<<arr[n]<<endl;
}

3.1.2. 2×n 타일링

#include<iostream>
using namespace std;
 
int arr[1100] = { 0, };
int main(){
  arr[0] = 1;
  arr[1] = 1;
  int n, ans;
  cin>> n;
  for(int i = 2; i<=n; i++){
    arr[i] = (arr[i-1] + arr[i-2]) % 10007;
  }
  cout<<arr[n]<<endl;
}

3.2. 박인서

  • 2xn 타일링 2

#include <iostream>

int a[1001];

int main()
{
	int n;
	std::cin >> n;
	
	a[1] = 1;
	a[2] = 3;
	for (int i = 3; i <= n; i++) {
		a[i] = (a[i - 1] + a[i - 2] * 2) % 10007;
	}

	std::cout << a[n];
	return 0;
}

  • 2xn 타일링

#include <iostream>

int a[1001];

int main()
{
	int n;
	std::cin >> n;
	
	a[1] = 1;
	a[2] = 2;
	for (int i = 3; i <= n; i++) {
		a[i] = (a[i - 1] + a[i - 2]) % 10007;
	}

	std::cout << a[n];
	return 0;
}

3.3. 곽정흠


4. 아이디어

4.1. 15이원준


4.2. 박인서

  • 전형적인 Dynamic Programming

4.3. 곽정흠

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:07
Processing time 0.0183 sec