'commit'
This commit is contained in:
39
C++专题课程/NOIP算法总结/模拟/JAM计数法/P1061.cpp
Normal file
39
C++专题课程/NOIP算法总结/模拟/JAM计数法/P1061.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
char ch[26],l,r;
|
||||
int w,i,k,j;
|
||||
cin>>i>>j>>w;
|
||||
l=i+'a'-1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ
|
||||
r=j+'a'-1;
|
||||
cin>>ch;
|
||||
for(i=1;i<=5;i++)
|
||||
{
|
||||
j=w-1; //<2F><>'<27><>λ'<27><>ʼ<EFBFBD><CABC>
|
||||
cout<<"<EFBFBD><EFBFBD>'<27><>λ'<27><>ʼ<EFBFBD><CABC> i<><69><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>"<<i<<endl;
|
||||
//------------------------------------------------<2D><>
|
||||
while(j>=0&&ch[j]==r+j+1-w)
|
||||
{
|
||||
printf("%c ",r+j+1-w);
|
||||
cout<<ch[j]<<" "<<"ttt<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>j<EFBFBD><EFBFBD>"<<j<<" <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ch<63><68>"<<ch<<endl;
|
||||
j--; //<2F>ҵ<EFBFBD><D2B5><EFBFBD>ǰΪ<C7B0>˰<EFBFBD><CBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>С<EFBFBD><D0A1><EFBFBD><EFBFBD>
|
||||
}
|
||||
if(j==-1)
|
||||
break;
|
||||
//------------------------------------------------<2D><>
|
||||
cout<<"yuanlai<EFBFBD><EFBFBD>"<<ch[j];
|
||||
ch[j]++; //<2F><>λ
|
||||
cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>"<<ch[j]<<endl;
|
||||
for (k=j+1;k<=w-1;k++)
|
||||
ch[k]=ch[k-1]+1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ֮<CEBB><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cout<<ch<<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD>1<2<3<4...
|
||||
<EFBFBD><EFBFBD>Jam<EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>a>b>c>d...
|
||||
*/
|
||||
6
C++专题课程/NOIP算法总结/模拟/JAM计数法/题目链接.txt
Normal file
6
C++专题课程/NOIP算法总结/模拟/JAM计数法/题目链接.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
P1061 Jam<61>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
https://www.luogu.org/problem/P1061
|
||||
|
||||
|
||||
ACMNO.51 JAM<41><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>ĸ˳<C4B8><CBB3>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
https://blog.csdn.net/weixin_42859280/article/details/89387129
|
||||
15
C++专题课程/NOIP算法总结/模拟/不高兴的津津/P1085.cpp
Normal file
15
C++专题课程/NOIP算法总结/模拟/不高兴的津津/P1085.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main () {
|
||||
int a,b,s,max=0,i,day=0;
|
||||
for (i=1; i<8; i++) {
|
||||
cin>>a>>b;
|
||||
s=a+b;
|
||||
if ((s>max)&&(s>8)) {
|
||||
max=s;
|
||||
day=i;
|
||||
}
|
||||
}
|
||||
cout<<day;
|
||||
return 0;
|
||||
}
|
||||
1
C++专题课程/NOIP算法总结/模拟/不高兴的津津/题目链接.txt
Normal file
1
C++专题课程/NOIP算法总结/模拟/不高兴的津津/题目链接.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://www.luogu.org/problem/P1085
|
||||
26
C++专题课程/NOIP算法总结/模拟/津津的储蓄计划/P1089.cpp
Normal file
26
C++专题课程/NOIP算法总结/模拟/津津的储蓄计划/P1089.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include<iostream>
|
||||
#include<stdio.h>
|
||||
using namespace std;
|
||||
int main() {
|
||||
int i,month,left=0,save=0,sum,plan,flag=0;
|
||||
for(month=1; month<=12; month++) {
|
||||
left+=300;
|
||||
scanf("%d",&plan);
|
||||
left = left - plan;
|
||||
if(left<0) {
|
||||
flag=1;
|
||||
break;
|
||||
} else {
|
||||
i = left/100;
|
||||
save += (100*i);
|
||||
left -= (100*i);
|
||||
}
|
||||
}
|
||||
if(flag>0)
|
||||
printf("-%d",month);
|
||||
else {
|
||||
sum=((1.2*save) + left);
|
||||
printf("%d",sum);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
1
C++专题课程/NOIP算法总结/模拟/津津的储蓄计划/题目链接.txt
Normal file
1
C++专题课程/NOIP算法总结/模拟/津津的储蓄计划/题目链接.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://www.luogu.org/problem/P1089
|
||||
1
C++专题课程/NOIP算法总结/模拟/编码问题/情况.txt
Normal file
1
C++专题课程/NOIP算法总结/模拟/编码问题/情况.txt
Normal file
@@ -0,0 +1 @@
|
||||
û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
1
C++专题课程/NOIP算法总结/模拟/编码问题/题目链接.txt
Normal file
1
C++专题课程/NOIP算法总结/模拟/编码问题/题目链接.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://www.luogu.org/problem/P1246
|
||||
46
C++专题课程/NOIP算法总结/模拟/花生采摘/P1086.cpp
Normal file
46
C++专题课程/NOIP算法总结/模拟/花生采摘/P1086.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include<iostream>
|
||||
#include<queue>
|
||||
#include<cmath>
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct hs //指花生:)
|
||||
{
|
||||
int x, y, v;
|
||||
bool operator < (const hs & a) const
|
||||
{
|
||||
return v < a.v;
|
||||
}//优先队列默认从大到小排序,但是需要用到小于号,所以这里重载运算符 < (只重载<就可以了)
|
||||
};
|
||||
|
||||
priority_queue <hs> q;
|
||||
|
||||
int main()
|
||||
{
|
||||
int m, n, k;
|
||||
int sum = 0;
|
||||
cin >> m >> n >> k;
|
||||
int a;
|
||||
hs t;
|
||||
for(int i = 1; i <= m; i++)
|
||||
for(int j = 1; j <= n; j++)
|
||||
{
|
||||
cin >> a;
|
||||
t.v = a;
|
||||
t.x = j;
|
||||
t.y = i;
|
||||
if(a != 0) //如果有数值,就推进队列
|
||||
q.push(t);
|
||||
}
|
||||
k -= q.top().y; //走到最大的花生植株
|
||||
while(!q.empty() && k > q.top().y) //第一个是检验队列不为空,如果空了说明全摘完了,第二个是检验剩余的时间可以走回路边
|
||||
{
|
||||
k--; //只要进入一次循环,说明到了一棵植株,采摘耗费1时间
|
||||
sum += q.top().v;
|
||||
int lx = q.top().x, ly = q.top().y;
|
||||
q.pop();//换下一棵树
|
||||
k -= abs(lx - q.top().x) + abs(ly - q.top().y);//剩余的时间减去从上一棵植株到这棵的时间
|
||||
}
|
||||
cout << sum << endl;
|
||||
return 0;
|
||||
}
|
||||
3
C++专题课程/NOIP算法总结/模拟/花生采摘/题目链接.txt
Normal file
3
C++专题课程/NOIP算法总结/模拟/花生采摘/题目链接.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
https://www.luogu.org/problem/P1086
|
||||
|
||||
https://www.luogu.org/problemnew/solution/P1086?page=7
|
||||
29
C++专题课程/NOIP算法总结/模拟/谁拿了最多奖学金/P1051.cpp
Normal file
29
C++专题课程/NOIP算法总结/模拟/谁拿了最多奖学金/P1051.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,score1,score2,sum=0,max=0,total=0,x,i;
|
||||
char a,b;
|
||||
string name,maxn;
|
||||
cin>>n;
|
||||
for(i=1;i<=n;i++)
|
||||
{
|
||||
cin>>name>>score1>>score2>>a>>b>>x;
|
||||
if(score1>80 && x>0)//判断是否获得院士奖学金
|
||||
sum+=8000;
|
||||
if(score1>85 && score2>80)//判断是否获得五四奖学金
|
||||
sum+=4000;
|
||||
if(score1>90)//判断是否获得成绩优秀奖
|
||||
sum+=2000;
|
||||
if(score1>85 && b=='Y')//判断是否获得西部奖学金
|
||||
sum+=1000;
|
||||
if(score2>80 && a=='Y')//判断是否获得班级贡献奖
|
||||
sum+=850;
|
||||
total+=sum;//累加奖学金
|
||||
if(sum>max)//找出最牛学生
|
||||
maxn=name,max=sum;//sum的用处
|
||||
sum=0;
|
||||
}
|
||||
cout<<maxn<<endl<<max<<endl<<total;
|
||||
return 0;
|
||||
}
|
||||
1
C++专题课程/NOIP算法总结/模拟/谁拿了最多奖学金/题目链接.txt
Normal file
1
C++专题课程/NOIP算法总结/模拟/谁拿了最多奖学金/题目链接.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://www.luogu.org/problem/P1051
|
||||
Reference in New Issue
Block a user