mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2025-10-09 18:48:38 +00:00
add new
This commit is contained in:
10
code/HelloHacktoberfest.sol
Normal file
10
code/HelloHacktoberfest.sol
Normal file
@@ -0,0 +1,10 @@
|
||||
pragma solidity ^0.4.20;
|
||||
|
||||
// Hacktober greetings smart contract
|
||||
contract HelloHacktoberfest {
|
||||
|
||||
function Hello() external view returns (string) {
|
||||
return "Hello Hacktoberfest 2018!";
|
||||
}
|
||||
|
||||
}
|
1
code/HelloWorld.py
Normal file
1
code/HelloWorld.py
Normal file
@@ -0,0 +1 @@
|
||||
print ("Hello World")
|
6
code/Shwetago.py
Normal file
6
code/Shwetago.py
Normal file
@@ -0,0 +1,6 @@
|
||||
###
|
||||
|
||||
s = 'Hello, world!'
|
||||
str(s)
|
||||
|
||||
###
|
2
code/first.txt
Normal file
2
code/first.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
<html>
|
||||
<
|
11
code/kamaliqlaas.rb
Normal file
11
code/kamaliqlaas.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class HelloWorld
|
||||
def initialize(name)
|
||||
@name = name.capitalize
|
||||
end
|
||||
def say_hi
|
||||
puts "Hello #{@name}!"
|
||||
end
|
||||
end
|
||||
|
||||
hello = HelloWorld.new("World")
|
||||
hello.say_hi
|
22
code/pr.cpp
Normal file
22
code/pr.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
bool isOverlap(pair<int,int> p1,pair<int,int> p2,pair<int,int> p3,pair<int,int> p4){
|
||||
if(p1.first>p4.first || p2.first<p3.first) return false;
|
||||
if(p1.second<p4.second || p2.second>p3.second) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(){
|
||||
int t;
|
||||
cin>>t;
|
||||
while(t--){
|
||||
pair<int,int> p1,p2,p3,p4;
|
||||
cin>>p1.first>>p1.second;
|
||||
cin>>p2.first>>p2.second;
|
||||
cin>>p3.first>>p3.second;
|
||||
cin>>p4.first>>p4.second;
|
||||
cout<<isOverlap(p1,p2,p3,p4)<<'\n';
|
||||
}
|
||||
return 0;
|
||||
}
|
84
code/simcache.pl
Normal file
84
code/simcache.pl
Normal file
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
############################################################
|
||||
### Usage: simcache.pl n_blocks n_blocksPerSet(associativity) n_wordsPerBlock TracerFile
|
||||
### ex : simcache.pl 128 1 4 trace1.txt
|
||||
### output: n_access n_missRate n_substitutions
|
||||
### ex : 300 20 35
|
||||
###
|
||||
### Celso A. Uliana Junior - Aug 2016
|
||||
############################################################
|
||||
|
||||
die "Usage: simcache.pl n_blocks n_blocksPerSet(associativity) n_wordsPerBlock TracerFile\n " if ( @ARGV != 4 );
|
||||
|
||||
|
||||
my $n_set = ( my $blocks = shift) / ( my $assoc = shift);
|
||||
my $n_words = shift;
|
||||
my $tracerfile = shift;
|
||||
my %cs;
|
||||
my $i = 0, my $j = 0;
|
||||
my $n_access, my $n_miss, my $n_substitutions, my $n_missRate;
|
||||
my $n_log_words = log($n_words)/log(2);
|
||||
|
||||
############################################################
|
||||
# If tracerfile is not .txt adds .txt to the string
|
||||
############################################################
|
||||
|
||||
if($tracerfile !~ /^\w+\.(doc|txt)$/){
|
||||
$tracerfile = $tracerfile . ".txt";
|
||||
}
|
||||
|
||||
############################################################
|
||||
# Reading tracer file
|
||||
############################################################
|
||||
|
||||
open TRC , "$tracerfile" or die "Couldn't open the file $tracerfile\n" ;
|
||||
|
||||
|
||||
|
||||
my $test = 0 ;
|
||||
my $test2 = 0 ;
|
||||
my $test3 = 0 ;
|
||||
|
||||
my $hit = 0 ;
|
||||
while( <TRC> ){
|
||||
chomp ;
|
||||
if( $n_set == $blocks ){
|
||||
if( $cs{int(($_ / 4) % $n_set)}[0] ){
|
||||
$test = int(($_ / 4) % $n_set);
|
||||
$test2 = int( ($_ / 4) / $n_set );
|
||||
$test3 = $cs{int(($_ / 4) % $n_set)}[2] ;
|
||||
print "indice = $test // tag esperada = $test2 // tag no hash = $test3 \n";
|
||||
if( $cs{int(($_ / 4) % $n_set)}[2] != int( ($_ / 4) / $n_set ) ){
|
||||
$n_miss++;
|
||||
$n_substitutions++;
|
||||
$cs{(int($_ / 4) % $n_set)}[2] = int( ($_ / 4) / $n_set );
|
||||
}
|
||||
else{
|
||||
$hit++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$cs{int(($_ / 4) % $n_set)}[0] = 1;
|
||||
$n_miss++ ;
|
||||
$cs{int(($_ / 4) % $n_set)}[2] = int( ($_ / 4) / $n_set);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$n_access++;
|
||||
}
|
||||
|
||||
print "hits = $hit // misses = $n_miss\n";
|
||||
close TRC;
|
||||
|
||||
############################################################
|
||||
# Print the n_acess n_missrate n_substitutions
|
||||
############################################################
|
||||
|
||||
printf ("%d %d %d \n", $n_access, (($n_miss / $n_access) * 100), $n_substitutions);
|
||||
|
||||
exit(0);
|
||||
############################################################
|
Reference in New Issue
Block a user