Skip to content

Instantly share code, notes, and snippets.

View tabvn's full-sized avatar

Toan tabvn

  • Danang, Vietnam
View GitHub Profile
@tabvn
tabvn / The Next Palindrome.cpp
Last active November 8, 2018 09:53
The Next Palindrome
#include <iostream>
#include <vector>
using namespace std;
vector<string> v;
int paseInt(char c) {
switch (c) {
void displayCoupleOfNumber(int n){
int b = 0;
int tmp = sqrt(n);
int a = tmp;
while(true){
if(a<=0 || b >= tmp){
break;
}
if(a*a + b*b < n){
cout << "(" << a << ", "<< b<< ")" << endl;
#include <iostream>
#include <vector>
using namespace std;
/*
S = 1/0! + 1/1! + 1/2! + ... 1/n!
mau chung se bang n!
ta tinh theo kieu quy dong len roi gian uoc dan dan
*/
#include <iostream>
using namespace std;
struct Time
{
int h,m,s;
};
Time t1,t2;
#include <iostream>
using namespace std;
struct Time
{
int h,m,s;
};
Time t1,t2;
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
/*
e^x = x^0/0! + x^1/1! + ... x^n/n!
*/
double chia(double x, double ep, int n){
@tabvn
tabvn / gomin.cpp
Last active October 25, 2018 14:31
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
ifstream fi ("/Users/toan/ued/GOMIN.INP");
ofstream fo ("/Users/toan/ued/GOMIN.OUT");
int timerIndex = -1;
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
bool isPrime(long int n){
if(n < 2){
return false;
}
#include <iostream>
#include <fstream>
#include <vector>
#import <cstdlib> // khai báo để tí nữa dùng hàm abs
using namespace std;
ifstream fi ("/Users/toan/ued/18-10-2018/GOMIN.INP");
ofstream fo ("/Users/toan/ued/18-10-2018/GOMIN.OUT");
#include <iostream>
#include <fstream>
#include <vector>
#include <math.h>
using namespace std;
ifstream fi ("/Users/toan/ued/18-10-2018/SCARD.INP");
ofstream fo ("/Users/toan/ued/18-10-2018/SCARD.OUT");