Skip to content

Commit

Permalink
2014
Browse files Browse the repository at this point in the history
  • Loading branch information
hycinth22 committed Feb 9, 2021
1 parent 5007b55 commit 6d654f4
Show file tree
Hide file tree
Showing 28 changed files with 1,016 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 2014/1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, cnt=0; scanf("%d", &n);
while(n){
++cnt;
n/=10;
}
printf("%d", cnt);
}

10 changes: 10 additions & 0 deletions 2014/14-1/14-1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include<iostream>
#include<string>
using namespace std;

int main() {
string str;
cin>>str;
cout<<str.length()<<endl; //直接返回字符串长度即可,不会溢出
return 0;
}
62 changes: 62 additions & 0 deletions 2014/14-1/14-1.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[Project]
FileName=14-1.dev
Name=14-1
Type=1
Ver=2
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
IsCpp=1
Icon=
ExeOutput=
ObjectOutput=
LogOutput=
LogOutputEnabled=0
OverrideOutput=0
OverrideOutputName=
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000001000000
UnitCount=1

[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
SyncProduct=1

[Unit1]
FileName=14-1.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

29 changes: 29 additions & 0 deletions 2014/14-1/Makefile.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Project: 14-1
# Makefile created by Dev-C++ 5.2.0.3

CPP = g++.exe -D_DEBUG_ -D__DEBUG__
CC = gcc.exe -D_DEBUG_ -D__DEBUG__
WINDRES = windres.exe
OBJ = 14-1.o $(RES)
LINKOBJ = 14-1.o $(RES)
LIBS = -L"E:/Ѹ������/DevCpp/Dev-Cpp/MinGW32/lib" -static-libstdc++ -static-libgcc -g3
INCS = -I"E:/Ѹ������/DevCpp/Dev-Cpp/MinGW32/include"
CXXINCS = -I"E:/Ѹ������/DevCpp/Dev-Cpp/MinGW32/include"
BIN = 14-1.exe
CXXFLAGS = $(CXXINCS) -g3 -g3
CFLAGS = $(INCS) -g3 -g3
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before 14-1.exe all-after


clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o "14-1.exe" $(LIBS)

14-1.o: 14-1.cpp
$(CPP) -c 14-1.cpp -o 14-1.o $(CXXFLAGS)
16 changes: 16 additions & 0 deletions 2014/14-2/14-2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include<iostream>
#include<string>
using namespace std;

int cow(int year) {
if(year<3) //母牛从第三年开始生产,则前两年母牛的数量为1头
return 1;
else
return cow(year-1)+cow(year-3); //递归求母牛的数量
}

int main() {
for (int i=1; i<=20; i++) { //遍历输出从第一年到第20年的母牛数量
cout<<cow(i-1)<<" ";
}
}
62 changes: 62 additions & 0 deletions 2014/14-2/14-2.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[Project]
FileName=14-2.dev
Name=14-2
Type=1
Ver=2
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
IsCpp=1
Icon=
ExeOutput=
ObjectOutput=
LogOutput=
LogOutputEnabled=0
OverrideOutput=0
OverrideOutputName=
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000001000000
UnitCount=1

[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
SyncProduct=1

[Unit1]
FileName=14-2.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

29 changes: 29 additions & 0 deletions 2014/14-2/Makefile.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Project: 14-2
# Makefile created by Dev-C++ 5.2.0.3

CPP = g++.exe -D_DEBUG_ -D__DEBUG__
CC = gcc.exe -D_DEBUG_ -D__DEBUG__
WINDRES = windres.exe
OBJ = 14-2.o $(RES)
LINKOBJ = 14-2.o $(RES)
LIBS = -L"E:/Ѹ������/DevCpp/Dev-Cpp/MinGW32/lib" -static-libstdc++ -static-libgcc -g3
INCS = -I"E:/Ѹ������/DevCpp/Dev-Cpp/MinGW32/include"
CXXINCS = -I"E:/Ѹ������/DevCpp/Dev-Cpp/MinGW32/include"
BIN = 14-2.exe
CXXFLAGS = $(CXXINCS) -g3 -g3
CFLAGS = $(INCS) -g3 -g3
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before 14-2.exe all-after


clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o "14-2.exe" $(LIBS)

14-2.o: 14-2.cpp
$(CPP) -c 14-2.cpp -o 14-2.o $(CXXFLAGS)
62 changes: 62 additions & 0 deletions 2014/14-3/14-3.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[Project]
FileName=14-5.dev
Name=14-5
Type=1
Ver=2
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
IsCpp=1
Icon=
ExeOutput=
ObjectOutput=
LogOutput=
LogOutputEnabled=0
OverrideOutput=0
OverrideOutputName=
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000000
UnitCount=1

[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
SyncProduct=1

[Unit1]
FileName=main.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

29 changes: 29 additions & 0 deletions 2014/14-3/Makefile.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Project: 14-5
# Makefile created by Dev-C++ 5.2.0.3

CPP = g++.exe -D_DEBUG_
CC = gcc.exe -D_DEBUG_
WINDRES = windres.exe
OBJ = main.o $(RES)
LINKOBJ = main.o $(RES)
LIBS = -L"E:/Ѹ������/DevCpp/Dev-Cpp/MinGW32/lib" -static-libstdc++ -static-libgcc
INCS = -I"E:/Ѹ������/DevCpp/Dev-Cpp/MinGW32/include"
CXXINCS = -I"E:/Ѹ������/DevCpp/Dev-Cpp/MinGW32/include"
BIN = 14-3.exe
CXXFLAGS = $(CXXINCS) -g3
CFLAGS = $(INCS) -g3
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before 14-3.exe all-after


clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o "14-3.exe" $(LIBS)

main.o: main.cpp
$(CPP) -c main.cpp -o main.o $(CXXFLAGS)
57 changes: 57 additions & 0 deletions 2014/14-3/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include <iostream>
using namespace std;
/*运动员分组比赛,有N个人参加100米短跑比赛。有8条跑道,如何分组使分组数目最少,
且每组人数相差最少。例如:N=8或少于8时,就1组。N=9时,应分成2组:5个人和4个人。
输入一个正整数(4-100)之间表示参赛人数。
输出每个组的人数,人数按从大到小顺序输出。例如,输入:25 输出7,6,6,6*/

int main() {
int n;
cin>>n; //输入总人数
if(n<4||n>100) {
cout<<"非法!"<<endl;
return 0;
}
int g=(n+7)/8; //分组数
if (g>8) //超过8的直接分8组
g=8;
int num=n/g; //每组人数
int r=n%g; //分组余数
for (int i=0; i<r; i++) { //余数均分
cout<<num+1<<" ";
}
for (int j=0; j<g-r; j++) {
cout<<num<<" ";
}
}
/*int main(int argc, char *argv[]) {
int n,t,a[8];
cin>>n;
if(n%8==0){
t=n/8;
for(int i=0;i<t;i++)
a[i]=8;
}else{
t=n/8+1;
if(n%t==0){
for(int i=0;i<t;i++)
a[i]=n/t;
}else{
for(int i=0;i<t;i++)
a[i]=n/t;
int m=n%t;
for(int i=0;i<m;i++)
a[i]=a[i]+1;
}
}
for(int i=0;i<t-1;i++){
cout<<a[i]<<",";
}
cout<<a[t-1];
return 0;
}*/



Loading

0 comments on commit 6d654f4

Please sign in to comment.