佬,hr面结束大概多久发offer呀,我上周五才面完hr面
点赞 1

相关推荐

03-02 17:46
已编辑
广州商学院 Java
查看19道真题和解析
点赞 评论 收藏
分享
(码风很屎别在意~)1.很简单直接都是一个数字就行#include <bits/stdc++.h>using namespace std;#define endl '\n';void solve() {int n;cin >> n;vector<int> v(n + 1);for(int i = 1; i <= n; i++) {cin >> v[i];cout << (n + 1) - v[i] << " \n"[i == n];}}int main() {ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);int t;cin >> t;while(t--) {solve();}}2.只用算平方就行了,直接暴力。如下#include <bits/stdc++.h>using namespace std;#define endl '\n';bool cal(int x) {int tot = 0;for(int i = 1; i * i <= x; i++) {if(x / i * i == x)tot += 2;}if(tot % 2)return false;else return true;}void solve() {int l, r;cin >> l >> r;int lmin = sqrt(l);int ans = 0;lmin = lmin * lmin == l ? lmin : lmin + 1;if(lmin == 1)ans++, lmin++;for(int i = lmin; i * i <= r; i++) {if(cal(i * i))ans++;}cout << ans;}int main() {ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);int t;t = 1;while(t--) {solve();}}3.稍微推一下公式就行,题解如下#include <bits/stdc++.h>using namespace std;#define endl '\n';#define int long longint mod = 1e9 + 7;const int N = 1e6 + 10;int a[N];void solve() {int k, q;cin >> k >> q;for(int i = 1; i <= k; i++) {a[i] = 1;}a[k + 1] = k ;int tot = k;for(int i = k + 2; i <= 1000000; i++) {tot = ((tot + a[i - 1])  - a[i - k - 1]);a[i] = tot % mod;}while(q--) {int x;cin >> x;cout << a[x] % mod << endl;}}signed main() {ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);int t;t = 1;while(t--) {solve();}}
一起聊美团
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务