first commit · algorithmsCode/algorithm@9481609 · GitHub
Skip to content

Commit 9481609

Browse files
committed
first commit
0 parents  commit 9481609

1,289 files changed

Lines changed: 1362966 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cf/107/WinOrFreeze.cpp

Lines changed: 83 additions & 0 deletions

cf/107/a.out

14.1 KB
Binary file not shown.

cf/107/phonenumber.cpp

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#include <iostream>
2+
#include <stdio.h>
3+
#include <string>
4+
#define MAX_SIZE 400
5+
using namespace std;
6+
7+
int n;
8+
int n_phonenumber;
9+
string friends[MAX_SIZE];
10+
string phone_number;
11+
12+
int girls[MAX_SIZE];
13+
int pizza[MAX_SIZE];
14+
int taxi[MAX_SIZE];
15+
16+
int judge(string phone){
17+
string t = "";
18+
for(int i=0; i<phone.size();i++){
19+
if(phone[i]<='9' && phone[i]>='0'){
20+
t+=phone[i];
21+
}
22+
}
23+
if(t.size()==6){
24+
int eq = 1;
25+
for(int i=1; i<6; i++){
26+
if(t[i]!=t[i-1]){
27+
eq = 0;
28+
break;
29+
}
30+
}
31+
if(eq==1){
32+
return 1;
33+
}
34+
35+
int sm = 1;
36+
for(int i=1; i<6; i++){
37+
if(t[i]<t[i-1]){
38+
continue;
39+
}else{
40+
sm = 0;
41+
}
42+
}
43+
if(sm==1){
44+
return 2;
45+
}
46+
}
47+
return 3;
48+
}
49+
50+
51+
int main(){
52+
for(int i=0; i<MAX_SIZE; i++){
53+
taxi[i]=0;
54+
pizza[i]=0;
55+
girls[i]=0;
56+
}
57+
cin>>n;
58+
int max_taxi=-1, max_girl=-1, max_pizza = -1;
59+
for(int i=0; i<n; i++){
60+
cin>>n_phonenumber>>friends[i];
61+
for(int j = 0; j<n_phonenumber; j++){
62+
cin>>phone_number;
63+
int t = judge(phone_number);
64+
if(t==1){
65+
taxi[i]++;
66+
}else if(t==2){
67+
pizza[i]++;
68+
}else{
69+
girls[i]++;
70+
}
71+
}
72+
if(taxi[i]>max_taxi){
73+
max_taxi = taxi[i];
74+
}
75+
if(pizza[i]> max_pizza){
76+
max_pizza = pizza[i];
77+
}
78+
if(girls[i] > max_girl){
79+
max_girl = girls[i];
80+
}
81+
}
82+
int there_are = 0;
83+
cout<<"If you want to call a taxi, you should call:";
84+
for(int i=0; i<n; i++){
85+
if(taxi[i]==max_taxi){
86+
if(there_are){
87+
cout<<",";
88+
}
89+
there_are = 1;
90+
cout<<" "<<friends[i];
91+
}
92+
}cout<<"."<<endl;
93+
94+
there_are = 0;
95+
cout<<"If you want to order a pizza, you should call:";
96+
for(int i=0; i<n; i++){
97+
if(pizza[i]==max_pizza){
98+
if(there_are){
99+
cout<<",";
100+
}
101+
there_are = 1;
102+
cout<<" "<<friends[i];
103+
}
104+
}cout<<"."<<endl;
105+
106+
there_are = 0;
107+
cout<<"If you want to go to a cafe with a wonderful girl, you should call:";
108+
for(int i=0; i<n; i++){
109+
if(girls[i]==max_girl){
110+
if(there_are){
111+
cout<<",";
112+
}
113+
there_are = 1;
114+
cout<<" "<<friends[i];
115+
}
116+
}cout<<"."<<endl;
117+
return 0;
118+
}

cf/107/softdrink.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <iostream>
2+
using namespace std;
3+
int min(int a,int b){
4+
return a<b?a:b;
5+
}
6+
7+
int main(){
8+
int n,k,l,c,d,p,nl,np;
9+
cin>>n>>k>>l>>c>>d>>p>>nl>>np;
10+
int drink = k*l/nl;
11+
int lime = c*d;
12+
int salt = p/np;
13+
int toast = drink;
14+
toast = min(toast, lime);
15+
toast = min(toast, salt);
16+
cout<<toast/n<<endl;
17+
return 0;
18+
}
19+

cf/108/Marks.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <iostream>
2+
3+
#define MAX_SIZE 200
4+
using namespace std;
5+
int n,m;
6+
int data[MAX_SIZE][MAX_SIZE];
7+
8+
int get_max(int sub){
9+
int t_max = -99999999;
10+
for(int i=0; i<n; i++){
11+
if(data[i][sub]>t_max){
12+
t_max = data[i][sub];
13+
}
14+
}
15+
return t_max;
16+
}
17+
18+
19+
void work(){
20+
int stu=0;
21+
for(int i=0; i<n; i++){
22+
for(int j=0; j<m; j++){
23+
//cout<<j<<" "<<get_max(j)<<endl;
24+
if(get_max(j)==data[i][j]){
25+
stu+=1;
26+
break;
27+
}
28+
}
29+
}
30+
cout<<stu<<endl;
31+
32+
}
33+
34+
35+
int main(){
36+
cin>>n>>m;
37+
for(int i=0; i<n; i++){
38+
for(int j=0; j<m ;j++){
39+
char c;
40+
//scanf("%c",&c);
41+
cin>>c;
42+
data[i][j] = c-'0';
43+
//cout<<data[i][j];
44+
}
45+
//cout<<endl;
46+
}
47+
work();
48+
49+
50+
51+
return 0;
52+
}
53+

cf/108/PocketBook.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include <iostream>
2+
3+
#define MAX_SIZE 200
4+
using namespace std;
5+
6+
char data[MAX_SIZE][MAX_SIZE];
7+
int n,m;
8+
void work(){
9+
long long int sum=1;
10+
for(int j=0; j<m; j++){
11+
int tmp[MAX_SIZE];
12+
for(int k =0; k<MAX_SIZE; k++)tmp[k]=0;
13+
int num=0;
14+
for(int i=0; i<n; i++){
15+
if(tmp[data[i][j] -'A']==0){
16+
tmp[data[i][j] - 'A']=1;
17+
num++;
18+
}else{
19+
continue;
20+
}
21+
}
22+
sum = sum*num % 1000000007;
23+
}
24+
cout<<sum<<endl;
25+
}
26+
27+
28+
int main(){
29+
cin>>n>>m;
30+
for(int i=0; i<n; i++){
31+
for(int j=0; j<m ;j++){
32+
char c;
33+
cin>>c;
34+
data[i][j] = c;
35+
}
36+
}
37+
work();
38+
39+
40+
41+
return 0;
42+
}
43+

cf/108/Steps.cpp

Lines changed: 68 additions & 0 deletions

cf/108/a.out

9.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)