diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9d6bd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,215 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg diff --git a/cikti.txt b/cikti.txt new file mode 100644 index 0000000..d74d047 --- /dev/null +++ b/cikti.txt @@ -0,0 +1,8 @@ +34 +78 +56 +93 +56 +88 +94 +93 diff --git a/matrix.txt b/matrix.txt new file mode 100644 index 0000000..c41990f --- /dev/null +++ b/matrix.txt @@ -0,0 +1,8 @@ +08 02 22 97 38 15 00 40 +49 49 99 40 17 81 18 57 +81 49 31 73 55 79 14 29 +52 70 95 23 04 60 11 42 +22 31 16 71 51 95 63 89 +24 47 32 60 99 03 45 02 +32 98 81 99 64 23 67 10 +67 26 20 68 02 62 12 20 \ No newline at end of file diff --git a/metin.txt b/metin.txt new file mode 100644 index 0000000..1cbcd4e --- /dev/null +++ b/metin.txt @@ -0,0 +1,3 @@ +sorrrulaar teknik ekibimiz taraafffından hazırrlanıp DeÄŸerlendirilecektir. +Ä°lk Eeetapp sorularınıı çÇçözebilen programlar yazabilen Yarışşşmacılardan +sırasıyla il k 10 kiÅŸi fina l eeetabına kalllmaya hakkk Kazanacaktır. \ No newline at end of file diff --git a/src/FifthQuestion.java b/src/FifthQuestion.java new file mode 100644 index 0000000..5cbef62 --- /dev/null +++ b/src/FifthQuestion.java @@ -0,0 +1,22 @@ +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.util.Scanner; + + +public class FifthQuestion { + + /** + * @param args + */ + public static void main(String[] args) { + // TODO Auto-generated method stub + try { + Scanner in = new Scanner(new FileReader("filename.txt")); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} diff --git a/src/FinalQuestion.java b/src/FinalQuestion.java new file mode 100644 index 0000000..0ad801e --- /dev/null +++ b/src/FinalQuestion.java @@ -0,0 +1,26 @@ +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.util.Scanner; + + +public class FinalQuestion { + + /** + * @param args + */ + public static void main(String[] args) { + // TODO Auto-generated method stub + try { + Scanner in = new Scanner(new FileReader("filename.txt")); + + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + + + } + +} diff --git a/src/FirstQuestion.java b/src/FirstQuestion.java new file mode 100644 index 0000000..f9b89fb --- /dev/null +++ b/src/FirstQuestion.java @@ -0,0 +1,127 @@ +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.util.Scanner; + +public class FirstQuestion { + + public static class Point { + private int x, y; + + public void set(int x, int y) { + this.x = x; + this.y = y; + } + public int getX(){ + return x; + } + public int getY(){ + return y; + } + + + public String toString() { + return "X is " + x + " Y is " + y; + } + } + + static Point[] points = new Point[3]; + + /** + * @param args + */ + public static void main(String[] args) { + + int[][] array = new int[8][8]; + for (int i = 0; i < 3; i++) { + points[i] = new Point(); + } + + int temp; + int max = 0; + + // TODO Auto-generated method stub + try { + Scanner in = new Scanner(new FileReader("matrix.txt")); + + for(int i=0 ;i<8;i++){ + for(int j =0;j<8;j++){ + array[i][j] = in.nextInt(); + } + } + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + + + // Saðdan Sola denemeler + for (int i = 0; i < 8; i++) { + for (int j = 2; j < 8; j++) { + if ((array[i][j] * array[i][j - 1] * array[i][j - 2]) > max) { + points[0].set(i, j); + points[1].set(i, j - 1); + points[2].set(i, j - 2); + + max = array[i][j] * array[i][j - 1] * array[i][j - 2]; + + } + + } + } + + // Aþaðýdan Yukarýya Denemeler + for (int i = 2; i < 8; i++) { + for (int j = 0; j < 8; j++) { + if ((array[i][j] * array[i - 1][j] * array[i - 2][j]) > max) { + points[0].set(i, j); + points[1].set(i - 1, j); + points[2].set(i - 2, j); + + max = array[i][j] * array[i - 1][j] * array[i - 2][j]; + + } + + } + } + + // Sað alt Çapraz denemeler + for (int i = 0; i < 6; i++) { + for (int j = 0; j < 6; j++) { + if ((array[i][j] * array[i + 1][j + 1] * array[i + 2][j + 2]) > max) { + points[0].set(i, j); + points[1].set(i + 1, j + 1); + points[2].set(i + 2, j + 2); + + max = array[i][j] * array[i + 1][j + 1] + * array[i + 2][j + 2]; + + } + + } + } + + // Sol alt Çapraz denemeler + for (int i = 0; i < 6; i++) { + for (int j = 2; j < 8; j++) { + if ((array[i][j] * array[i + 1][j - 1] * array[i + 2][j - 2]) > max) { + points[0].set(i, j); + points[1].set(i + 1, j - 1); + points[2].set(i + 2, j - 2); + + max = array[i][j] * array[i + 1][j - 1] + * array[i + 2][j - 2]; + + } + + } + } + + System.out.println(array[points[0].x][points[0].y]); + System.out.println(array[points[1].x][points[1].y]); + System.out.println(array[points[2].x][points[2].y]); + System.out.println(max); + + } +} diff --git a/src/ForthQuestion.java b/src/ForthQuestion.java new file mode 100644 index 0000000..ba66a23 --- /dev/null +++ b/src/ForthQuestion.java @@ -0,0 +1,22 @@ +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.util.Scanner; + + +public class ForthQuestion { + + /** + * @param args + */ + public static void main(String[] args) { + // TODO Auto-generated method stub + try { + Scanner in = new Scanner(new FileReader("filename.txt")); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} diff --git "a/src/SalihER\304\260KC\304\2601.rar" "b/src/SalihER\304\260KC\304\2601.rar" new file mode 100644 index 0000000..4362638 Binary files /dev/null and "b/src/SalihER\304\260KC\304\2601.rar" differ diff --git "a/src/SalihER\304\260KC\304\2601.zip" "b/src/SalihER\304\260KC\304\2601.zip" new file mode 100644 index 0000000..02d0be9 Binary files /dev/null and "b/src/SalihER\304\260KC\304\2601.zip" differ diff --git "a/src/SalihER\304\260KC\304\2602.zip" "b/src/SalihER\304\260KC\304\2602.zip" new file mode 100644 index 0000000..ac6af37 Binary files /dev/null and "b/src/SalihER\304\260KC\304\2602.zip" differ diff --git "a/src/SalihER\304\260KC\304\2603.zip" "b/src/SalihER\304\260KC\304\2603.zip" new file mode 100644 index 0000000..4d46844 Binary files /dev/null and "b/src/SalihER\304\260KC\304\2603.zip" differ diff --git a/src/SecondQuestion.java b/src/SecondQuestion.java new file mode 100644 index 0000000..7feeae9 --- /dev/null +++ b/src/SecondQuestion.java @@ -0,0 +1,125 @@ +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Scanner; + +public class SecondQuestion { + + /** + * @param args + */ + public static void main(String[] args) { + // TODO Auto-generated method stub + try { + + Scanner in = new Scanner(new FileReader("metin.txt")); + + // Clear duplicate white spaces + String temp = new Scanner(new File("metin.txt"), "UTF-8") + .useDelimiter("\\A").next(); + + temp = temp.replaceAll("\\s+", " "); + System.out.println(temp); + + + temp = removeDuplicate(temp); + System.out.println(temp); + + + temp = capitalLetter(temp); + System.out.println(temp); + + temp = singleLetter(temp); + System.out.println(temp); + + BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream("cikti.txt")); + out.write(temp.getBytes()); + out.close(); + + + + + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + public static String removeDuplicate(String s) { + StringBuilder temp = new StringBuilder(s); + char x; + char y; + for (int i = 1; i < temp.length(); i++) { + x = Character.toLowerCase(temp.charAt(i)); + y = Character.toLowerCase(temp.charAt(i-1)); + + if(x==y){ + temp.deleteCharAt(i); + i--; + + } + } + return temp.toString(); + + } + + public static String capitalLetter(String s){ + StringBuilder temp = new StringBuilder(s); + char x; + + for(int i = 0;i visitedNodes = new ArrayList(); + ArrayList nodeArray = new ArrayList(); + ArrayList valueArray = new ArrayList(); + valueArray.add(99999999); + nodeArray.add(null); + + // TODO Auto-generated method stub + try { + Scanner in = new Scanner(new FileReader("yollar.txt")); + while (in.hasNext()) { + valueArray.add(in.nextInt()); + } + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + for (int i = 1; i < valueArray.size(); i++) { + if(nodeAdded == floor){ + nodeAdded = 0; + floor++; + } + + nodeArray.add(new Node(valueArray.get(i).intValue(),floor)); + nodeAdded++; + } + + for (int i = 1; i < nodeArray.size(); i++) { + if ( nodeArray.get(i).floor + i +1 < nodeArray.size()) { + nodeArray.get(i).leftChild = nodeArray.get(nodeArray.get(i).floor + i); + + + nodeArray.get(i).rightChild = nodeArray.get(nodeArray.get(i).floor + i+1); + + } + + } + + root = nodeArray.get(1); + + currentNode = root; + + //Begin traversing + while( currentNode.floor <= floor){ + currentNode.isVisited = true; + + visitedNodes.add(currentNode); + + + + + + if(!currentNode.hasChild()){ + floor =-1; + } + + + if(currentNode.hasChild()){ + if((currentNode.leftChild.value > currentNode.rightChild.value && !currentNode.leftChild.isVisited ) || currentNode.rightChild.isVisited){ + if((currentNode.leftChild.value >= BOUND) || skippedOnce){ + currentNode.leftChild.parent = currentNode ; + currentNode = currentNode.leftChild; + } + else{ + skippedOnce = true; + currentNode = currentNode.parent; + } + } + + else{ + if(currentNode.rightChild.value >= BOUND || skippedOnce){ + currentNode .rightChild.parent = currentNode ; + currentNode = currentNode.rightChild; + } + else{ + skippedOnce = true; + currentNode = currentNode.parent; + } + } + } + + } + + BufferedOutputStream out; + StringBuilder temp = new StringBuilder(); + try { + out = new BufferedOutputStream(new FileOutputStream("cikti.txt")); + for(Node n:visitedNodes){ + temp.append(n.value); + temp.append(System.getProperty("line.separator")); + System.out.println(n.value ); + } + out.write(temp.toString().getBytes()); + out.close(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + + + + + + + + } + +} diff --git a/yollar.txt b/yollar.txt new file mode 100644 index 0000000..661cef0 --- /dev/null +++ b/yollar.txt @@ -0,0 +1,6 @@ +34 +78 53 +29 56 90 +76 88 93 33 +45 94 27 29 71 +34 93 19 03 24 81 \ No newline at end of file