repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/config_type.h | <filename>baselines/1_CCGrid15/include/cowic/config_type.h
//config_type.h
#ifndef _CONFIG_TYPE_H_
#define _CONFIG_TYPE_H_
template <typename EnumType>
struct EnumName
{
static const char* List[];
};
enum class ModelType{
WordDict,
PhraseDict,
ColumnWised
};
template <>
const char* EnumName<ModelType... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/number_encoder.h | //number_encoder.h
#ifndef _NUMBER_ENCODER_H_
#define _NUMBER_ENCODER_H_
#include "encoder.h"
class NumberEncoder : public Encoder{
public:
void buildCoder(const unordered_map<string, int>& wordFreqDict);
bool isFresh(const string& word) const;
/** @word is in fact an positive integer.
*/
BitAr... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/number.h | //number.h
#ifndef _NUMBER_H_
#define _NUMBER_H_
#include <regex.h>
#include "abstract_number.h"
class Number : public AbstractNumber{
public:
Number(unsigned int numericVal, const string& beforeVal, const string& afterVal);
bool isIllegal() const;
static Number parse(const string& ipStr);
static co... |
JinYang88/LogZip | baselines/1_CCGrid15/src/encoder/canonical_huffman_encoder.h | /* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//canonical_huffman_encoder.h
#ifndef _CANONICAL_HUFFMAN_ENCODER_H_
#define _C... |
JinYang88/LogZip | baselines/1_CCGrid15/src/encoder/bit_array.h | /* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//bit_array.h
#ifndef _BIT_ARRAY_H
#define _BIT_ARRAY_H
#include <vector>
#inc... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/compressor_config.h | <gh_stars>1-10
//compressor_config.h
#ifndef _COMPRESSOR_CONFIG_H_
#define _COMPRESSOR_CONFIG_H_
#include <string>
#include <vector>
#include <memory>
#include "config_type.h"
using std::string;
using std::vector;
using std::shared_ptr;
class SpecifyConfig{
public:
SpecifyConfig(int columnVal, SpecifyColumnMod... |
JinYang88/LogZip | baselines/1_CCGrid15/src/encoder/encoder.h | <gh_stars>1-10
/* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//encoder.h
#ifndef _ENCODER_H
#define _ENCODER_H
#include <uno... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/timestamp_model.h | //timestamp_model.h
#ifndef _TIMESTAMP_MODEL_H_
#define _TIMESTAMP_MODEL_H_
#include <memory>
#include "model.h"
#include "dictionary_model.h"
using std::shared_ptr;
class TimestampModel : public Model{
public:
TimestampModel();
TimestampModel(const shared_ptr<DictionaryModel>& dictModelPtrVal, const strin... |
JinYang88/LogZip | baselines/1_CCGrid15/src/model/model.h | /* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//model.h
#ifndef _MODEL_H
#define _MODEL_H
#include <iostream>
#include <stri... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/timestamp.h | //timestamp.h
#ifndef _TIMESTAMP_H_
#define _TIMESTAMP_H_
#include "time.h"
#include <string>
#include <stdlib.h>
#include <regex.h>
using std::string;
class Timestamp{
public:
Timestamp(time_t timestampValue, const string& timezoneValue);
Timestamp(time_t timestampValue, const string& timezoneValue, const ... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/variable_byte_encoder.h | //variable_byte_encoder.h
#ifndef _VARIABLE_BYTE_ENCODER_H_
#define _VARIABLE_BYTE_ENCODER_H_
#include "number_encoder.h"
/* Variable byte (VB) encoding uses an integral number of bytes to encode a gap.
* The last 7 bits of a byte are ``payload'' and encode part of the gap.
* The first bit of the byte is a conti... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/abstract_number.h | <reponame>JinYang88/LogZip
//abstract_number.h
#ifndef _ABSTRACT_NUMBER_H_
#define _ABSTRACT_NUMBER_H_
#include <string>
using std::string;
class AbstractNumber{
public:
AbstractNumber(unsigned int numericVal, const string& beforeVal, const string& afterVal);
unsigned int getNumeric() const;
string getB... |
JinYang88/LogZip | baselines/1_CCGrid15/src/encoder/auxiliary_encoder.h | /* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//auxiliary_encoder.h
#ifndef _AUXILIARY_ENCODER_H_
#define _AUXILIARY_ENCODER... |
JinYang88/LogZip | baselines/1_CCGrid15/src/model/fix_precision_number_model.h | <gh_stars>1-10
/* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//fix_precision_number_model.h
#ifndef _FIX_PRECISION_NUMBER_MO... |
JinYang88/LogZip | baselines/1_CCGrid15/src/model/ip_model.h | <filename>baselines/1_CCGrid15/src/model/ip_model.h
/* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//ip_model.h
#ifndef _IP_M... |
JinYang88/LogZip | baselines/1_CCGrid15/src/encoder/word_list_encoder.h | <reponame>JinYang88/LogZip<gh_stars>1-10
/* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//word_list_encoder.h
#ifndef _WORD_L... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/fix_precision_number_model.h | //fix_precision_number_model.h
#ifndef _FIX_PRECISION_NUMBER_MODEL_H_
#define _FIX_PRECISION_NUMBER_MODEL_H_
#include "abstract_number_model.h"
#include "number_encoder.h"
class FixPrecisionNumberModel : public AbstractNumberModel{
public:
FixPrecisionNumberModel();
FixPrecisionNumberModel(const shared_ptr<D... |
JinYang88/LogZip | baselines/1_CCGrid15/src/encoder/fresh_encoder.h | /* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//fresh_encoder.h
#ifndef _FRESH_ENCODER_H_
#define _FRESH_ENCODER_H_
#includ... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/model.h | //model.h
#ifndef _MODEL_H
#define _MODEL_H
#include <iostream>
#include <string>
#include "bit_array.h"
using std::string;
using std::cout;
using std::endl;
class Model{
public:
Model();
virtual void updateColumn(const string& columnStr, int column) = 0;
virtual string dump() const = 0;
virtual voi... |
JinYang88/LogZip | baselines/1_CCGrid15/src/encoder/tree_node.h | /* Cowic is a C++ library to compress formatted log like Apache access log.
*
* Cowic is released under the New BSD license (see LICENSE.txt). Go to the
* project home page for more info:
*
* https://github.com/linhao1990/cowic.git
*/
//tree_node.h
#ifndef _TREE_NODE_H_
#define _TREE_NODE_H_
#include <memory>
... |
JinYang88/LogZip | baselines/1_CCGrid15/include/cowic/dictionary_model.h | <reponame>JinYang88/LogZip
//dictionary_model.h
#ifndef _DICTIONARY_MODEL_H
#define _DICTIONARY_MODEL_H
#include <memory>
#include "model.h"
#include "encoder.h"
#include "fresh_encoder.h"
using std::shared_ptr;
class DictionaryModel : public Model{
public:
DictionaryModel();
void updateWord(const string& w... |
vineyard2020/VineTalk | vine_Apps_EG/singleNode/opencl_darkGray/include/darkGrayArgs.h | #ifndef DARK_GREY_ARGS_HEADER
#define DARK_GREY_ARGS_HEADER
typedef struct {
int width; /**< Image width */
int height; /**< image height */
} darkGrayArgs;
#endif
|
vineyard2020/VineTalk | vine_Apps_EG/singleNode/opencl_darkGray/include/opencl_darkGray.h | <filename>vine_Apps_EG/singleNode/opencl_darkGray/include/opencl_darkGray.h
#ifndef OPENCL_DARKGRAY_H
#define OPENCL_DARKGRAY_H
#define CL_HPP_ENABLE_EXCEPTIONS
#define CL_HPP_TARGET_OPENCL_VERSION 120
#define CL_HPP_MINIMUM_OPENCL_VERSION 110
#define __CL_ENABLE_EXCEPTIONS
#include <CL/cl.hpp>
#ifdef RD_WG_SIZE_0_... |
vineyard2020/VineTalk | vine_Apps_EG/mesos/examples/kernelLib/include/realtype.h | /*
* Copyright 2018 Foundation for Research and Technology - Hellas
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0 [1] [1]
*
* Unless... |
ISISComputingGroup/CAENHVAsyn | CAENHVAsynApp/src/drvCAENHVAsyn.h | #ifndef DRV_CAEN_HV_ASYN_H
#define DRV_CAEN_HV_ASYN_H
/**
*-----------------------------------------------------------------------------
* Title : CAEN HV Asyn module
* ----------------------------------------------------------------------------
* File : drvCAENHVAsyn.h
* Author : <NAME>, <EMAIL>
... |
ISISComputingGroup/CAENHVAsyn | CAENHVAsynApp/src/common.h | <filename>CAENHVAsynApp/src/common.h
#ifndef COMMON_H
#define COMMON_H
/**
*-----------------------------------------------------------------------------
* Title : CAEN HV Asyn module
* ----------------------------------------------------------------------------
* File : common.h
* Author : <NAME>,... |
ISISComputingGroup/CAENHVAsyn | CAENHVAsynApp/src/board.h | #ifndef BOARD_H
#define BOARD_H
/**
*-----------------------------------------------------------------------------
* Title : CAEN HV Asyn module
* ----------------------------------------------------------------------------
* File : board.h
* Author : <NAME>, <EMAIL>
* Created : 2019-08-20
* -... |
ISISComputingGroup/CAENHVAsyn | CAENHVAsynApp/src/channel.h | <gh_stars>0
#ifndef CHANNEL_H
#define CHANNEL_H
/**
*-----------------------------------------------------------------------------
* Title : CAEN HV Asyn module
* ----------------------------------------------------------------------------
* File : channel.h
* Author : <NAME>, <EMAIL>
* Created ... |
ISISComputingGroup/CAENHVAsyn | CAENHVAsynApp/src/crate.h | #ifndef CRATE_H
#define CRATE_H
/**
*-----------------------------------------------------------------------------
* Title : CAEN HV Asyn module
* ----------------------------------------------------------------------------
* File : crate.h
* Author : <NAME>, <EMAIL>
* Created : 2019-08-20
* -... |
ISISComputingGroup/CAENHVAsyn | CAENHVAsynApp/src/channel_parameter.h | <reponame>ISISComputingGroup/CAENHVAsyn<gh_stars>0
#ifndef CHANNEL_PARAMETER_H
#define CHANNEL_PARAMETER_H
/**
*-----------------------------------------------------------------------------
* Title : CAEN HV Asyn module
* ----------------------------------------------------------------------------
* File ... |
mwdchang/delphi | external/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h | <reponame>mwdchang/delphi<filename>external/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2014 <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public Li... |
TheBadZhang/OJ | usx/special/60/6036-2.c | #include<stdio.h>
main(){puts("4562");} |
TheBadZhang/OJ | usx/special/60/6047.c | #include <stdio.h>
int main () {
int n, m;
while (~scanf ("%d %d", &n, &m)) { // 处理多组输入
int i, j;
int matrix[10][10]; // 定义一个矩阵(二维数组)
for (i = 0; i < n; i ++) {
for (j = 0; j < m; j ++) {
scanf ("%d", &matrix[i][j]); // 向矩阵输入数据
}
}
int maxi = 0, maxj = 0, mini =... |
TheBadZhang/OJ | usx/special/60/6016.c | #include <stdio.h>
double e (double i) {
double r = 2, s = 1;
int d;
for (d = 2; s >= i; d++) {
s /= d;
r += s;
}
return r;
}
int main () {
double i;
while (~scanf ("%lf", &i)) {
printf ("%.18lf\n", e(i));
}
return 0;
} |
TheBadZhang/OJ | usx/special/91/9102.c | #include <stdio.h>
int main () {
const double pi = 3.14159;
double r;
scanf ("%lf", &r);
printf ("%.2lf\n", 2*pi*r);
printf ("%.2lf\n", pi*r*r);
return 0;
} |
TheBadZhang/OJ | hdu/2000/20xx/2013.c | <gh_stars>1-10
#include<stdio.h>
int n,r[32]={1};main(){for(;n++<32;){r[n]=2*(r[n-1]+1);}while(~scanf("%d",&n)){printf("%d\n",r[n-1]);}}
|
TheBadZhang/OJ | usx/special/60/6044.c | <filename>usx/special/60/6044.c
#include <stdio.h>
int search (int* list, int size, int d) {
int start = 0, end = size, mid; // 二分搜索查找插入的位置
while (start <= end) {
mid = (start+end)/2;
if (d <= list [mid]) {
end = mid - 1;
} else {
start = mid + 1;
}
}
return start;
}
void moveRight (int* list, ... |
TheBadZhang/OJ | usx/special/60/6033.c | <filename>usx/special/60/6033.c
#include <stdio.h>
int main () {
int n;
while (~scanf ("%d", &n)) {
if (n >= 90) {
printf ("A\n");
} else if (n >= 80) {
printf ("B\n");
} else if (n >= 70) {
printf ("C\n");
} else if (n >= 60) {
printf ("D\n");
} else {
printf ("E\n");
}
}
} |
TheBadZhang/OJ | usx/special/60/6087.c | #include <stdio.h>
#include <string.h>
int main () {
int n;
while (~scanf ("%d\n", &n)) {
int i;
int score, maxscore;
char name[80], maxname[80], num[80];
for (i = 0; i < n; i++) {
scanf ("%s %s %d\n", num, name, &score);
if (i == 0 || score > maxscore) {
strcpy (maxname, name);
maxscore = sco... |
TheBadZhang/OJ | usx/special/91/9106.c | #include <stdio.h>
int main () {
double a, b;
scanf ("%lf %lf", &a, &b);
printf ("%.2lf\n", -b/a);
return 0;
} |
TheBadZhang/OJ | usx/special/91/9104.c | <gh_stars>1-10
#include <stdio.h>
int main () {
float a, b, h;
scanf ("%f %f %f", &a, &b, &h);
printf ("%.2f", (a+b)*h/2);
return 0;
} |
TheBadZhang/OJ | usx/special/60/6076.c | #include <stdio.h>
#include <ctype.h>
#include <string.h>
int main () {
int n;
char str [100];
while (~scanf ("%d\n", &n)) {
int i, j;
int lowercase = 0, capital = 0, space = 0, sign = 0;
for (i = 0; i < n; i++) {
gets (str);
for (j = 0; j < strlen(str); j++) {
if (isspace (str[j])) space ++;
... |
TheBadZhang/OJ | usx/special/60/6025.c | <filename>usx/special/60/6025.c
#include <stdio.h>
int main () {
int m, a, b, c;
for (m = 100; m < 1000; ++m) {
a = m / 100;
b = m / 10 % 10;
c = m % 10;
if (m == a*a*a + b*b*b + c*c*c) {
printf ("%d=%d*%d*%d+%d*%d*%d+%d*%d*%d\n",
m, a, a, a, b, b, b, c, c, c);
}
}
return 0;
}
|
TheBadZhang/OJ | usx/special/92/9218.c | <gh_stars>1-10
#include <stdio.h>
#include <math.h>
int main () {
int x1, y1, x2, y2;
while (~scanf ("%d %d %d %d", &x1, &y1, &x2, &y2)) {
printf ("%d\n", abs(x2-x1)*abs(y2-y1));
}
return 0;
} |
TheBadZhang/OJ | usx/special/92/9226.c | #include <stdio.h>
int gcd (int m, int n) {
return n?gcd(n,m%n):m;
}
int main () {
int T, m, n, i, mini;
scanf ("%d", &T);
while (T--) {
scanf ("%d %d %d", &i, &m, &n);
m *= i;
mini = gcd (m, n);
m /= mini; // 计算最大公约数
n /= mini; // 计算
if (m%n == 0) { // 可以约成整数
printf ("%d\n", m/n);
} else { ... |
TheBadZhang/OJ | usx/special/92/9205.c | <filename>usx/special/92/9205.c
#include <stdio.h>
int main () {
int a;
while (~scanf ("%d", &a)) {
if (a%2) {
printf ("odd\n");
} else {
printf ("even\n");
}
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6042.c | #include <stdio.h>
int main () {
int n;
int v[25][25] = {0};
while (~scanf ("%d", &n)) {
int i,j,c=1;
for (i = 0; i <= n/2; i++, c+=3*(n-2*i+1)) {
for (j = i; j < n-i-1; j++, c++) {
v[j][i] = c;
v[n-i-1][j] = (n-2*i-1)+c;
v[n-j-1][n-i-1] = 2*(n-2*i-1)+c;
v [i][n-j-1] = 3*(n-2*i-1)+c;
}
... |
TheBadZhang/OJ | usx/special/60/6078.c | <reponame>TheBadZhang/OJ
#include <stdio.h>
#include <math.h>
int isPrime (int n) {
int i;
if (!n&1) return 0;
for (i = 3; i <= sqrt (n); i+=2) {
if (n%i == 0) return 0;
}
return 1;
}
int main () {
int n;
while (~scanf ("%d", &n)) {
if (isPrime (n)) {
printf ("YES\n");
} else {
printf ("NO\n");
... |
TheBadZhang/OJ | usx/special/60/6010.c | #include <stdio.h>
int main () {
int n;
while (~scanf ("%d", &n)) {
if (n%3 == 0 && n%5 == 0) {
printf ("YES\n");
} else {
printf ("NO\n");
}
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6082.c | #include <stdio.h>
#include <stdlib.h>
void swap (int* a, int* b) {
int c = *a;
*a = *b;
*b = c;
}
struct element {
int value;
int i, j;
} s[225];
int cmp (const void* a, const void* b) {
// return (((struct element*)a) -> value - ((struct element*)b) -> value) ?
// (((struct element*)a) -> value - ((struct ... |
TheBadZhang/OJ | usx/special/92/9223.c | #include <stdio.h>
int main () {
int T, m, n, i, mini;
scanf ("%d", &T);
while (T--) {
scanf ("%d %d", &m, &n);
mini = m>n ? n : m;
for (i = 1; i <= mini; i++) {
if (n%i == 0 && m%i == 0) {
if (i != 1) printf (" ");
printf ("%d", i);
}
}
printf ("\n");
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6070.c | <gh_stars>1-10
#include <stdio.h>
#include <math.h>
int main () {
int n, i;
double a, b, c;
scanf ("%d", &n);
for (i = 0; i < n; i ++) {
scanf ("%lf %lf %lf", &a, &b, &c);
printf ("%.2lf %.2lf %.2lf\n", sin(a), sqrt(b), log(c));
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6020-2.c | #include<stdio.h>
main(){puts("YES");} |
TheBadZhang/OJ | usx/special/60/6067-2.c | <filename>usx/special/60/6067-2.c
#include <stdio.h>
int main () {
int i;
while (~scanf ("%x", &i)) {
printf ("%d\n", i);
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6001.c | <gh_stars>1-10
#include <stdio.h>
int main () {
printf ("I am a student.\nI love China.\n");
return 0;
} |
TheBadZhang/OJ | usx/special/60/6029.c | #include <stdio.h>
double abs (double x) {
if (x < 0) return -x;
else return x;
}
double sqrt (double x) {
double xn = 1, a = x;
while (abs(xn-(xn+a/xn)/2.0) >= 1e-7) {
// 1e-5 所计算得到的精度并不能满足题目的要求,所以我直接拉了两个量级
xn = (xn+a/xn)/2.0;
}
return xn;
}
int main () {
double n;
while (~scanf("%lf", &n)) {
printf ... |
TheBadZhang/OJ | usx/special/91/9110-2.c | <reponame>TheBadZhang/OJ
#include <stdio.h>
main(){puts("53 37 16");} |
TheBadZhang/OJ | usx/special/92/9209.c | <reponame>TheBadZhang/OJ<filename>usx/special/92/9209.c
#include <stdio.h>
int main () {
int s, w, p;
float price, rate;
while (~scanf ("%d %d %d", &s, &w, &p)) {
if (w < 2) {
rate = 0.98;
} else if (w < 4) {
rate = 0.96;
} else if (w < 6) {
rate = 0.94;
} else {
rate = 0.92;
}
if (s < 300)... |
TheBadZhang/OJ | usx/special/60/6065.c | <filename>usx/special/60/6065.c<gh_stars>1-10
#include <stdio.h>
int main () {
int n, i;
double x;
while (~scanf ("%d %lf", &n, &x)) {
if (n > 15 || n < 0) printf ("-10000.000000\n");
else {
double hermite [20] = { 1 };
hermite [1] = 2*x;
for (i = 2; i <= n; i ++)
hermite [i] = hermite[1]*hermite[... |
TheBadZhang/OJ | usx/special/91/9109.c | <filename>usx/special/91/9109.c
#include <stdio.h>
int main () {
int a, c;
double b, d;
scanf ("%d%lf %d%lf", &a, &b, &c, &d);
printf ("%.2lf %.2lf", b+c, a+d);
return 0;
} |
TheBadZhang/OJ | usx/special/60/6069.c | <gh_stars>1-10
#include <stdio.h>
int main () {
int n, nn;
scanf ("%d", &n);
int max, min, sum;
int i, ii, j;
for (i = 0; i < n; i++) {
scanf ("%d", &nn);
sum = 0;
for (j = 0; j < nn; j++) {
scanf ("%d", &ii);
if (j == 0) {
max = min = ii;
}
sum += ii;
if (max < ii) max = ii;
if (min ... |
TheBadZhang/OJ | usx/special/60/6049.c | #include <stdio.h>
int m,n,i,j;
int v[200][200] = {0};
int max_min (int ns, int ms) {
int ii, flag = 1;
for (ii = 0; ii < m; ii++) {
if (v[ns][ii] > v[ns][ms]) {
flag = 0;
}
}
for (ii = 0; ii < n; ii++) {
if (v[ii][ms] < v[ns][ms]) {
flag = 0;
}
}
return flag;
}
int main () {
while (~scanf ("%d... |
TheBadZhang/OJ | usx/special/60/6030.c | <filename>usx/special/60/6030.c
#include <stdio.h>
#include <math.h>
double f (double x) {
return 2*x*x*x-4*x*x+3*x-7;
}
double df (double x) {
return 6*x*x-8*x+3;
}
int main () {
double x = 1.5;
while (fabs(f(x)) >= 1e-5) {
x = x - f(x)/df(x);
}
printf ("%.6lf\n", x);
return 0;
} |
TheBadZhang/OJ | usx/special/92/9215.c | #include <stdio.h>
int isTriangle (double a, double b, double c) {
if (a+c <= b || a+b <= c || b+c <= a) {
return 0;
} else {
return 1;
}
}
int main () {
double a, b, c;
while (~scanf ("%lf %lf %lf", &a, &b, &c)) {
if (isTriangle (a, b, c)) {
if (a == b && b == c) {
printf ("equilateral triangle\n"... |
TheBadZhang/OJ | usx/special/92/9206.c | <filename>usx/special/92/9206.c
#include <stdio.h>
double f(double x) {
if (x < 0) {
return 0;
} else if (x < 10) {
return 2*x;
} else if (x < 50) {
return 2*x + 1;
} else {
return x/2.0+50;
}
}
int main () {
double x;
while (~scanf ("%lf", &x)) {
printf ("%.2lf\n", f(x));
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6031.c | <reponame>TheBadZhang/OJ
#include <stdio.h>
#include <math.h>
double f (double x) {
return 2*x*x*x-4*x*x+3*x-7;
}
int main () {
double l = -10.0, r = 10.0, m;
while (fabs (r-l) >= 1e-5) {
m = (l+r)/2.0;
if (f(l) < 0.0 && f(r) > 0.0) {
if (f(m) == 0.0) {
l = r = m;
} else if (f(m) < 0) {
l = m;
... |
TheBadZhang/OJ | usx/special/60/6052.c | <reponame>TheBadZhang/OJ
#include <string.h>
#include <stdio.h>
#include <ctype.h>
int main () {
int n;
char str[100];
char sstr [300] = { '\0' };
while (gets(str)) {
strcat (sstr, str);
gets(str);
strcat (sstr, str);
gets(str);
strcat (sstr, str);
int l = strlen (sstr);
int inWord = 0;
int space ... |
TheBadZhang/OJ | usx/special/91/9119.c | <reponame>TheBadZhang/OJ<filename>usx/special/91/9119.c
#include <stdio.h>
int main () {
int l = 0, i;
scanf ("%d", &i);
do {
l ++;
i /= 10;
} while (i > 0);
printf ("%d", l);
return 0;
} |
TheBadZhang/OJ | usx/special/60/6034.c | <filename>usx/special/60/6034.c
#include <stdio.h>
#include <string.h>
int main () {
char n[7], s, i;
while (~scanf ("%s", n)) {
s = strlen (n);
printf ("%d", s);
for (i = 0; i < s; i++) {
printf (" %c", n[i]);
}
printf (" ");
for (i = s-1; i >= 0; i--) {
printf ("%c",n[i]);
}
printf ("\n");
... |
TheBadZhang/OJ | usx/special/60/6057.c | #include <stdio.h>
#include <string.h>
int isAEIOU (char ch) {
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' ||
ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U')
return 1;
else
return 0;
}
int main () {
char src [100];
char dst [100];
while (gets (src) != NULL) {
int ... |
TheBadZhang/OJ | usx/special/60/6011.c | #include <stdio.h>
int gcd (int a, int b) {
return b?gcd(b,a%b):a;
}
// int gcd (int a, int b) {
// while (b^=a^=b^=a%=b);
// return x;
// }
int main() {
int m, n;
while (~scanf("%d %d", &m, &n)) {
printf ("%d\n", gcd(m, n));
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6028.c | #include <stdio.h>
int main () {
int n, N[22]={1}, i;
for (i = 1; i <= 22; i++) {
N[i] = (N[i-1]+1)*2;
}
while (~scanf("%d", &n)) {
printf ("%d\n", N[n-1]);
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6039.c | #include <stdio.h>
int josephus (int n, int m) {
if (n == 1) {
return 0;
} else {
return (josephus (n-1,m) + m)%n;
}
}
int main () {
int n, m, i, s = 0;
while(~scanf ("%d", &n)) {
printf ("%d\n", josephus (n,3)+1);
}
} |
TheBadZhang/OJ | usx/special/92/9224.c | <reponame>TheBadZhang/OJ
#include <stdio.h>
int main () {
int T, m, n, i, mini;
scanf ("%d", &T);
while (T--) {
scanf ("%d %d %d", &m, &n, &i);
printf ("%d %d\n", n+i*m, i);
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6012.c | <reponame>TheBadZhang/OJ
#include <stdio.h>
#include <math.h>
// #define min(a,b) (a<b?a:b)
// #define max(a,b) (a<b?b:a)
float min (float a, float b) {
return a > b ? b : a;
}
float max (float a, float b) {
return a < b ? b : a;
}
int main () {
float a, b, c, d, e;
while (~scanf("%f%f%f%f%f", &a, &b, &c, &d, &... |
TheBadZhang/OJ | usx/special/60/6019.c | <gh_stars>1-10
#include <stdio.h>
int main () {
int d, z, x;
for (d = 0; d <= 100/3; d ++) {
for (z = 0; z <= (100-3*d)/2; z ++) {
for (x = 0; x <= 2*(100-3*d-2*z); x += 2) {
if (3*d + 2*z + x/2 == 100 && 100 == d + z + x) {
printf ("%d %d %d\n", d, z, x);
}
}
}
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6023.c | #include <stdio.h>
int main () {
int n, a, i, s, aa;
while (~scanf ("%d %d", &n, &a)) {
s = 0;
aa = 0;
for (i=0; i < n; i++) {
aa = aa*10+a;
s += aa;
}
printf ("%d\n", s);
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6038.c | #include <stdio.h>
int list [400]; // 放在全局变量可以自动初始化为 0
int main () {
int i, j, k;
for (i = 1, j = 2; i < 250; i += j, j++) {
list [i] = 1; list [i-1] = 1; // 将杨辉三角的两边的 1 初始化
for (k = i + 1; k < i+j; k++) {
list [k] = list[k-j] + list[k-j+1];
// 计算杨辉三角
}
}
while (~scanf("... |
TheBadZhang/OJ | usx/special/60/6074.c | #include <stdio.h>
int main () {
int m, n, i, j;
int maxi, maxj;
int v [22][22];
while (~scanf ("%d %d", &m, &n)) {
maxi = maxj = 0;
for (i = 0; i < m; i ++) {
for (j = 0; j < n; j ++) {
scanf ("%d", &v[i][j]);
if (v[i][j] > v[maxi][maxj]) {
maxi = i;
maxj = j;
}
}
}
printf ("%... |
TheBadZhang/OJ | usx/special/60/6064.c | #include <stdio.h>
int ack (int m, int n) {
if (m == 0) return n+1;
else if (n == 0) return ack(m-1, 1);
else return ack (m-1, ack(m, n-1));
}
int main () {
int m, n;
while (~scanf ("%d%d", &m, &n)) {
printf ("%d\n", ack (m, n));
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6032-2.c | <gh_stars>1-10
#include <stdio.h>
#include <math.h>
int main () {
int n, i, j;
while (~scanf ("%d", &n)) {
for (i = 0; i < 2*n-1; printf ("\n"),i++) {
for (j = 0; j++ < 2*abs((n-i-1)); printf (" "));
for (printf ("*"),j = 0; j++ < 2*(n-1-abs(n-1-i)); printf (" *"));
}
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6084.c | <filename>usx/special/60/6084.c
#include <string.h>
#include <stdio.h>
int main () {
int n, m, k;
int stu[12][10];
while (~scanf ("%d %d %d", &n, &m, &k)) {
int i, j, flag, flag2 = 0, flag3, flag4 = 0, sum = 0, sum2;
double average;
for (i = 0; i < n; i++) {\
for (j = 0; j < m; j++) {
scanf ("%d", &st... |
TheBadZhang/OJ | usx/special/92/9214.c | <gh_stars>1-10
#include <stdio.h>
int main () {
int a, b;
char o;
while (~scanf ("%d %d\n%c", &a, &b, &o)) {
switch (o) {
case '+': printf ("%d+%d=%d\n", a, b, a+b); break;
case '-': printf ("%d-%d=%d\n", a, b, a-b); break;
case '*': printf ("%d*%d=%d\n", a, b, a*b); break;
case '/': printf ("%d/%d=%... |
TheBadZhang/OJ | usx/special/60/6088-2.c | #include <stdio.h>
int main () {
int n, i;
char name[80];
double value;
while (~scanf ("%d\n", &n)) {
for (i = 0; i < n; i++) {
scanf ("%s %lf", name, &value);
printf ("%s %.2lf\n", name, value);
}
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6040.c | <gh_stars>1-10
#include <stdio.h>
#include <math.h>
int isPrime (int n) {
int i;
for (i = 3; i <= sqrt (n); i++) {
if (n % i == 0) return 0;
}
return 1;
}
int main () {
int n, i = 2;
int sushu[300] = { 2, 3 };
for (n = 1; n < 40; n ++) {
if (isPrime (n*6-1)) sushu[i++] = n*6-1;
if (isPrime (n*6+1)) sush... |
TheBadZhang/OJ | usx/special/60/6068.c | #include <stdio.h>
#include <math.h>
int N;
double f (int n, double x, double z) {
double y;
if (n >= N) return 0.0;
if (n > 0) z = z * x * x / (2*n) / (2*n+1);
else z = x;
if (n&1) {
y = -z+f(n+1, x, z);
} else {
y = z+f(n+1, x, z);
}
// printf ("%d %lf %lf %lf\n", n, x, z, y);
return y;
}
int main () {
... |
TheBadZhang/OJ | usx/special/60/6036.c | #include <stdio.h>
int main () {
int fibo [50] = { 1, 1, 2, 3 };
int i;
for (i = 2; i < 50; i++) {
fibo [i] = fibo [i-1] + fibo [i-2];
}
int n;
while (~scanf ("%d", &n)) {
for (i = 1; i <= n; i++) {
// if (i%5 != 1) printf (" ");
if (i%5!=1) printf (" ");
printf ("%d", fibo [i-1]);
if (i%5 == 0)... |
TheBadZhang/OJ | usx/special/60/6013.c | <filename>usx/special/60/6013.c
#include <stdio.h>
int main () {
int year;
while (~scanf("%d", &year)) {
if (year % 100 == 0 && year % 400 == 0 ||
year % 100 != 0 && year % 4 == 0) {
printf ("is LEAP!\n");
} else {
printf ("is NOT LEAP!\n");
}
}
return 0;
} |
TheBadZhang/OJ | usx/special/91/9118-2.c | <reponame>TheBadZhang/OJ
#include <stdio.h>
int main () {
puts("CD");
return 0;
} |
TheBadZhang/OJ | usx/special/60/6075.c | <filename>usx/special/60/6075.c
#include <stdio.h>
int main () {
int n, m;
int s[20][20];
int a, b;
while (~scanf("%d%d", &a, &b)) {
for (n = 0; n < a; n++) {
for (m = 0; m < b; m++) {
scanf ("%d", &s[n][m]);
}
}
for (n = 0; n < a; n++) {
int flag = 0;
for (m = 0; m < b; m++) {
if (s[n][... |
TheBadZhang/OJ | usx/special/60/6041.c | <reponame>TheBadZhang/OJ
#include <stdio.h>
#include <stdlib.h>
int comp(const void* a, const void* b) {
return *(int*)a - *(int*)b;
}
void swap (int* a, int* b) {
int c = *a;
*a = *b;
*b = c;
}
void bubbleSort (int* list, int size) {
int i, j;
for (i = 0; i < size; i ++) {
for (j = i+1; j < size; j++) {
... |
TheBadZhang/OJ | usx/special/60/6066.c | #include <stdio.h>
double P (double x, int n) {
if (n == 0) return 1.0;
else if (n == 1) return x;
else if (n > 1) return ((2*n-1)*x-P(x,n-1)-(n-1)*P(x,n-2))/(double)n;
}
int main () {
double x;
int n;
while (~scanf ("%d %lf", &n, &x)) {
printf ("%.6lf\n", P(x,n));
}
return 0;
} |
TheBadZhang/OJ | usx/special/92/9217.c | #include <stdio.h>
int main () {
char str[1024];
int i;
while (~scanf ("%s", str)) {
i = 0;
while (str[i++]);
printf ("%d\n", i-1);
}
} |
TheBadZhang/OJ | usx/special/60/6059.c | #include <stdio.h>
#include <string.h>
#include <ctype.h>
int main () {
char str[100];
while (gets(str) != NULL) {
int count [128] = {0};
int i, j = 0;
for (i = 0; i < strlen (str); i++) {
if (isalpha (str[i])) {
count [str[i]] ++;
}
}
int counts = 0;
for (i = 0; i < 128; i ++) {
if (count[... |
TheBadZhang/OJ | usx/special/92/9207.c | #include <stdio.h>
int main () {
float a;
while (~scanf ("%f", &a)) {
if (a <= 50.0) {
printf ("%.2f\n", a*0.15);
} else {
printf ("%.2f\n", 7.5+(a-50)*0.25);
}
}
return 0;
} |
TheBadZhang/OJ | usx/special/60/6085.c | <gh_stars>1-10
#include <stdio.h>
#include <math.h>
#include <string.h>
void output(char *s, int n); //声明输出函数
int main() {
char str[300] = {0};
while (gets (str) != NULL) {
output (str, strlen (str)+1); //调用输出函数
}
return 0;
}
//输出函数
void output(char *s, int n) {
char *i;
int j, ... |
TheBadZhang/OJ | usx/special/60/6024.c | #include <stdio.h>
int main () {
int n, i;
double s;
while (~scanf ("%d", &n)) {
s = 0.0;
for (i = 1; i <= n; ++i) {
s += (double)i;
s += (double)i*(double)i;
s += 1.0/(double)i;
}
printf ("%.6lf\n", s);
}
return 0;
} |
TheBadZhang/OJ | leetcode/0000/1-500/461.c | <reponame>TheBadZhang/OJ<filename>leetcode/0000/1-500/461.c
int hammingDistance(int x, int y){
int max = x > y ? x : y;
int min = x > y ? y : x;
int count = 0;
while (max > 0) {
if (max & 1 ^ min & 1) count ++;
// printf ("%d %d\n", max, min);
max >>... |
TheBadZhang/OJ | usx/special/60/6021.c | <filename>usx/special/60/6021.c
#include <stdio.h>
int main () {
int i = 0;
while (i++, !(i%2==1 && i%3==2 && i%5==4 && i%6==5 && i%7==0));
printf ("%d", i);
return 0;
} |
TheBadZhang/OJ | usx/special/60/6086.c | <reponame>TheBadZhang/OJ
#include <stdio.h>
struct STU {
int num;
char name[20];
char sex;
int age;
int score [3];
};
int main () {
struct STU stu[10];
int n, i;
while (~scanf ("%d", &n)) {
for (i = 0; i < n; i ++) {
scanf ("%d %s\n%c%d%d%d%d",
&stu[i].num, stu[i].name,
&stu[i].sex, &stu[i].ag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.