听说是邀请赛啊,大概做了做…中午出去吃了个饭回来过掉的I。然后去做作业了……
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath> using namespace std; #define fr first
#define sc second
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Full(a) memset((a), 0x7f7f, sizeof(a)) typedef long long ll;
const int maxn = ;
string s;
int g[]; int main() {
// FRead();
int T;
Rint(T);
while(T--) {
string pre;
int pos = ;
Cls(g);
while(cin >> s) {
if(s[] == 'E') break;
if(::s == pre) {
pos = - pos;
g[pos]++;
pre = ::s;
}
else {
g[pos]++;
pre = ::s;
}
}
// cout << g[0] << " "<< g[1] <<endl;
printf("%d\n", g[] * g[]);
}
return ;
}
C
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath> using namespace std; #define fr first
#define sc second
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Full(a) memset((a), 0x7f7f, sizeof(a)) typedef long long ll;
ll n, k; int main() {
// FRead();
while(~Rint(n) && ~Rint(k)) {
ll t;
while() {
if(t == n) break;
t = n;
n /= ;
n += k;
}
cout << t << endl;
}
return ;
}
H
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath> using namespace std; #define fr first
#define sc second
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Full(a) memset((a), 0x7f7f, sizeof(a)) const int maxn = ;
double n, V;
double a[maxn], v[maxn];
double ans; int main() {
// FRead();
while(cin >> n >> V) {
bool exflag = ;
ans = ;
Rep(i, n) {
cin >> a[i] >> v[i];
if(abs(v[i]) >= V && a[i] != ) exflag = ;
}
if(exflag) {
printf("Bad Dog\n");
continue;
}
double pos = ;
Rep(i, n) {
a[i] += ans * v[i];
if(a[i] == pos) continue;
if(a[i] < pos) V = - * abs(V);
else V = abs(V);
if(abs(V - v[i]) <= ) {
exflag = ;
break;
}
double d = abs(pos - a[i]);
double t = d / abs(V - v[i]);
ans += t;
pos += t * V;
}
if(exflag) printf("Bad Dog\n");
else printf("%.2lf\n", ans);
}
return ;
}
I
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath> using namespace std; #define fr first
#define sc second
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Full(a) memset((a), 0x7f7f, sizeof(a)) const int maxn = ;
int h[maxn];
int ans;
int n; int check(int d) {
int ret = ;
int tmp = ;
for(int i = ; i <= ; i++) {
tmp = ;
if(h[i] == ) continue;
for(int j = i; j <= ; j+=d) {
if(h[j]) tmp++;
else break;
}
ret = max(tmp, ret);
}
return ret;
} int main() {
// FRead();
int tmp;
while(~Rint(n)) {
Cls(h);
ans = ;
Rep(i, n) {
Rint(tmp);
h[tmp]++;
}
//d = 0
for(int i = ; i <= ; i++) {
ans = max(ans, h[i]);
}
for(int d = ; d <= ; d++) {
ans = max(ans, check(d));
}
cout << ans << endl;
}
return ;
}
J