Last active
January 5, 2021 01:24
-
-
Save behitek/4bc9ac03b07e25136cb7cf0d05885679 to your computer and use it in GitHub Desktop.
Công cụ LUYENCODE.NET
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
import sys | |
import os | |
import re | |
inp = sys.argv[1] | |
os.system('mkdir -p out') | |
os.system('rm -rf out/*') | |
os.system('unzip -d out {} > /dev/null 2>&1'.format(inp)) | |
def atoi(text): | |
return int(text) if text.isdigit() else text | |
def natural_keys(text): | |
''' | |
alist.sort(key=natural_keys) sorts in human order | |
http://nedbatchelder.com/blog/200712/human_sorting.html | |
(See Toothy's implementation in the comments) | |
''' | |
return [ atoi(c) for c in re.split(r'(\d+)', text) ] | |
infiles = [x for x in os.listdir('out/in')] | |
infiles.sort(key=natural_keys) | |
idx = 1 | |
for f in infiles: | |
print('mv out/in/{} out/{}.in'.format(f, idx)) | |
os.system('mv out/in/{} out/{}.in'.format(f, idx)) | |
os.system('mv out/out/{} out/{}.out'.format(f, idx)) | |
idx += 1 | |
os.system('cd out && zip tc.zip *.in *.out > /dev/null 2>&1') | |
os.rename('out/tc.zip', inp) |
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
import random | |
import sys | |
import sys | |
import string | |
sys.stdout = open(sys.argv[1], 'w') | |
m = random.randint(1, 1000) | |
print(m) | |
for i in range(m): | |
print(random.randint(0, 1000000000), end= ' ') |
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
#include <bits/stdc++.h> | |
#define _for(i,a,b) for (int i=(a),_b_=(b);i<_b_;i++) | |
#define _fod(i,a,b) for (int i=(a),_b_=(b);i>_b_;i--) | |
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i) | |
#define _all(v) v.begin(), v.end() | |
#define __(v) memset(v,0,sizeof(v)) | |
using namespace std; | |
typedef long long LL; | |
typedef unsigned long long ULL; | |
template<typename T> vector<T> &operator += (vector<T> &v, T x) {v.push_back(x);return v;} | |
int n; | |
int a[20]; | |
void printResult(){ | |
_for(i,0,n) cout<<a[i]; | |
cout<<endl; | |
} | |
void callback(int i){ | |
_for(j,0,2){ | |
a[i] = j; | |
if(i == n-1) printResult(); | |
else callback(i+1); | |
} | |
} | |
void solve() { | |
cin>>n; | |
callback(0); | |
} | |
int main(int argc, char *argv[]){ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
freopen(argv[1],"r",stdin); | |
freopen(argv[2],"w",stdout); | |
solve(); | |
} | |
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
import sys | |
sys.stdin = open(sys.argv[1], 'r') | |
sys.stdout = open(sys.argv[2], 'w') | |
import numpy as np | |
import re | |
count = {} | |
n = int(input()) | |
s = 1 | |
for i in range(2, n+1): | |
s *= i | |
while s % 10 == 0: | |
s //= 10 | |
print(s % 10) |
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
#include <fstream> | |
#include <iostream> | |
#include <string> | |
#include <cctype> | |
#define AC 0 | |
#define WA 1 | |
#define ERROR -1 | |
int spj(std::ifstream &input, std::ifstream &user_output); | |
int main(int argc, char *args[]){ | |
int result; | |
if(argc != 3){ | |
std::cout << "Usage: spj x.in x.out\n"; | |
return ERROR; | |
} | |
std::ifstream input(args[1]); | |
std::ifstream user_output(args[2]); | |
if(input.fail() || user_output.fail()){ | |
std::cout << "Failed to open output file\n"; | |
input.close(); | |
user_output.close(); | |
return ERROR; | |
} | |
result = spj(input, user_output); | |
std::cout << "result: " << result << "\n"; | |
input.close(); | |
user_output.close(); | |
return result; | |
} | |
int spj(std::ifstream &input, std::ifstream &user_output){ | |
std::string s1 = "hello world!"; | |
std::string s2; | |
std::getline(user_output, s2); | |
bool ok = true; | |
if (s1.length() != s2.length()) { | |
std::cerr << "Output length differs." << std::endl; | |
ok = false; | |
} else { | |
for (size_t i = 0; i < s1.length(); i++) { | |
if (tolower(s1[i]) != tolower(s2[i])) { | |
std::cerr << "The " << i + 1 << "-th character differs. Expected '" << s2[i] << "'; got '" << s1[i] << "'." << std::endl; | |
ok = false; | |
} | |
} | |
} | |
if (ok) { | |
return AC; | |
} | |
return WA; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment