This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import print_function | |
| # PRINT VALUE FROM S to N | |
| s = int(raw_input()) | |
| n = int(raw_input()) | |
| print(*range(s,n+1),sep=' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % m is the matrix | |
| % to check if a matrix has inverse or not, use det(). | |
| if det(m)~=0 | |
| % The matrix has inverse | |
| minv = inv(m); | |
| else | |
| % The matrix doesn't has inverse | |
| % Approximate the inverse using SVD | |
| [U,S,V] = svd(m); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int productOfSubsetSums(int arr[], int n) | |
| { | |
| int ans = 1; | |
| for (int i = 0; i < n; ++i ) | |
| ans = ans * (arr[i] + 1); | |
| return ans-1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Example : | |
| # a = [1,2,3] | |
| # x = subset(a) * x=> [[], [3], [2], [2, 3], [1], [1, 3], [1, 2], [1, 2, 3]] | |
| # x.sort() * x => [[], [1], [1, 2], [1, 2, 3], [1, 3], [2], [2, 3], [3]] | |
| def subset(a): | |
| if a == []: | |
| return [[]] | |
| i = subset(a[1:]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Get list of all JPG files in this directory | |
| % DIR returns as a structure array. You will need to use () and . to get | |
| % the file names. | |
| imagefiles = dir('*.jpg'); | |
| nfiles = length(imagefiles); % Number of files found | |
| for ii=1:nfiles | |
| currentfilename = imagefiles(ii).name; | |
| currentimage = imread(currentfilename); | |
| images{ii} = currentimage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Misal kita memiliki matriks data dengan 3 atribut dan kelas dari data | |
| % Misal nama matriks data adalah 'data_latih' | |
| % matriks data akan berbentuk seperti ini : | |
| % Atribut1 | Atribut2 | Atribut 3| Kelas | | |
| % a1 | a2 | a3 | 0 | | |
| % b1 | b2 | b3 | 0 | | |
| % c1 | c2 | c3 | 0 | | |
| % d1 | d2 | d3 | 1 | | |
| % e1 | e2 | e3 | 1 | | |
| % f1 | f2 | f3 | 2 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| histogram(pic) := | for bright in 0..255 | |
| | pixels_at_level_bright = 0 | |
| | for x in 0 .. cols(pic) - 0 | |
| | for y in 0 .. rows(pic) - 1 | |
| | | level = pic(y,x) | |
| | | pixels_at_level(level) = pixels_at_level(level) + 1 | |
| | pixels_at_level |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def myround(x, base=5): | |
| return int(base * round(float(x)/base)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <body> | |
| <div class="container"> | |
| <div class="well"> | |
| <h1 class="text-center"> John Lasseter</h1> | |
| <h3 class="text-center"> The Man behind Pixar </h2> | |
| <div class="text-center"> | |
| <img src="https://upload.wikimedia.org/wikipedia/commons/1/17/John_Lasseter_2_cropped_2009.jpg" /> | |
| </div> | |
| <!-- content goes here --> | |
| <div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Read Image | |
| img = imread('....'); | |
| % Create Noise Image | |
| noiseGaussianImage = imnoise(img,'gaussian'); |
OlderNewer