4月vp训练赛1

目录

Problem - 1337A - Codeforces 1.简单思维

Problem - 1057A - Codeforces 思维

Problem - 1335B - Codeforces 思维

 Problem - 140A - Codeforces数学​

https://vjudge.net/problem/CodeForces-1623B/origin 思维/较难


 

Problem - 1337A - Codeforces 1.简单思维

 题意:输出满足

条件的三角形的三边,x,y,z.

思路:很水的题但是我看到第一眼居然没马上出思路,队友一看完题就会了.感觉自己脑子还是转的慢,唉. 

#include <iostream>
#include<ctime>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<algorithm>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define ll long long
int T;
int arr[2000001];
int main() {
   /* freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);*/
    ios::sync_with_stdio(false); cout.tie(NULL);
    cin >> T;
    while (T--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        cout << b << " " << c << " " << c << endl;;
    }


}

Problem - 1057A - Codeforces 思维

 题意:当前给定序列和起点n,当前位置的元素可以跳转到当前位置对应值处的位置,输出从

n开始的跳转路径.

思路:一开始看了半天都没看懂题目,不过看懂了就很好做了.链式跳转即可,起点为n

//#include<bits/std c++.h>
#include <iostream>
#include<ctime>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<algorithm>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define ll long long
int T;
int arr[2000001];
int nx[1000001];
vector<int>res;
int main() {
   /* freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);*/
    ios::sync_with_stdio(false); cout.tie(NULL);
    int n;
    cin >> n;
    
    for (int j = 2; j <= n; j++) {
        cin >> arr[j];
    }
    for (int j = n; j >= 2; j--) {
        nx[j] = arr[j];
    }
    int x = n;
    while (x != 0) {
        res.push_back(x);
        x = nx[x];
    }
    while (!res.empty()) {
        cout << res.back() << " ";
        res.pop_back();
    }
}

Problem - 1335B - Codeforces 思维

 

 题意:给定n,m,k输出一个长度为 n,且所有长度为 m 的子串里都只有 k种字母的字符串

思路:刚看没啥思路,队友提醒了找特殊情况,比如字符串 abcabca不管怎么框,每个对应的子串里都只可能有abc三个字符.所以思路就出来了.重复'a'-'a'+k的字符即可

//#include<bits/std c++.h>
#include <iostream>
#include<ctime>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<algorithm>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define ll long long
int T;
int arr[2000001];
int nx[1000001];
vector<int>res;
int main() {
   /* freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);*/
    ios::sync_with_stdio(false); cout.tie(NULL);
    cin >> T;
    while (T--) {
        int n, a, b;
        string s = "";
        cin >> n >> a >> b;
        for (int j = 0; j < n; j++) {
            char t = (j % b)+'a';
            cout << t;
        }
        cout << endl;
    }
}

 Problem - 140A - Codeforces数学

题意:判断一个半径为R的大圆盘上是否放下 n 个半径为r的小圆盘.

思路:

当然是先考虑一个大圆盘要放n个小圆盘的极限半径情况.然后对比给定的r,得出结论.这题难就难在如何得到极限的r.用数学方法,小圆盘可以紧贴,要放置越多的小圆盘那么当然得是紧贴的情况,所以每个小圆盘都会对应一个圆心角,所有小圆盘圆心角相加则为2*pi,利用反三角函数则可以得到r和圆心角的关系.

最后还要注意精度. 

//#include<bits/std c++.h>
#include <iostream>
#include<ctime>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<algorithm>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#pragma warning (disable:4996);
#define ll long long
int T;
int arr[2000001];
int nx[1000001];
vector<int>res;

#define ens 1e-12
double  pi = acos(-1);
const double b = (double)180/pi ;
struct node {
    int l, r;
}per[1000001];
int main() {
    //freopen("in.txt", "r", stdin);
   // freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false); cout.tie(NULL);
    int n, R, r;
    cin >> n >> R >> r;
    if (n == 1) {
        if (r <= R)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    else {
        double t = asin((double)r / (R - r));
        if(n*2*t<=2*pi+ens)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

https://vjudge.net/problem/CodeForces-1623B/origin 思维/较难

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值