NEERC 2014 took place in St. Petersburg, Barnaul, Tbilisi and Tashkent on December 6-7, 2014
来源:互联网 发布:httpclient post 数据 编辑:程序博客网 时间:2024/04/29 14:57
A.
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;int n, m;int main(){ freopen("alter.in", "r", stdin); freopen("alter.out", "w", stdout); while(~scanf("%d%d", &n, &m)) { int ans ; //if(n == 2) ans = n / 2 + m / 2; printf("%d\n", ans); int f1 = 0, f2 = 0; if(n & 1) f1 = 1; if(m & 1) f2 = 1; int i = 1, j = 1; if(m & 1) i = 2; if(n & 1) j = 2; for( ; i <= m; i += 2) { printf("1 %d %d %d\n", i, n, i); } for( ; j <= n; j += 2) { printf("%d 1 %d %d\n", j, j, m); } } return 0;}
#include <algorithm>#include <iostream>#include <cstring>#include <cstdio>#include <cmath>using namespace std;const int MAXN = 1e5 + 10;struct Node { double g, a, b, s; int id;};Node node[MAXN];int n;double a, b, sa, sb;bool cmp1( const Node &a, const Node &b ) { return a.a / a.b > b.a / b.b;}bool cmp2( const Node &a, const Node &b ) { return a.id < b.id;}int main() { freopen( "burrito.in", "r", stdin ); freopen( "burrito.out", "w", stdout ); scanf( "%d%lf%lf", &n, &a, &b ); sa = sb = 0; for( int i = 0; i < n; ++i ) { scanf( "%lf%lf%lf", &node[i].g, &node[i].a, &node[i].b ); node[i].s = 0.0; node[i].id = i; } sort( node, node + n, cmp1 ); for( int i = 0; i < n; ++i ) { if( node[i].b == 0.0 ) { sa += node[i].g * node[i].a; node[i].s = node[i].g; continue; } if( b >= node[i].g * node[i].b ) { b -= node[i].g * node[i].b; sa += node[i].g * node[i].a; sb += node[i].g * node[i].b; node[i].s = node[i].g; } else { double k = b / node[i].b; b -= k * node[i].b; sa += k * node[i].a; sb += k * node[i].b; node[i].s = k; } if( b == 0.0 ) break; } sort( node, node + n, cmp2 ); if( sa < a ) puts( "-1 -1" ); else { printf( "%.10f %.10f\n%.10f", sa, sb, node[0].s ); for( int i = 1; i < n; ++i ) { printf( " %.10f", node[i].s ); } puts( "" ); } return 0;}
J.
#include <cstdio>#include <vector>#include <cstring>#include <iostream>#include <algorithm>using namespace std;#define N 100char s[N];int a[N];int _hash[N];int m, n;bool flag, mark;int go[N];void dfs(int pos, int flag){ //cout << "pos: " << pos << endl; if(mark) return ; if(pos == m + 1) { for(int i = 1; i <= n; i++) if(!_hash[i]) return; mark = true; memset(go, 0, sizeof go); for(int i = 1; i <= n; i++) { //cout << i << " : " << _hash[i] << endl; go[_hash[i]] = i; } int cnt = 0; for(int i = 1; i <= m; i++) { if(go[i]) { ++cnt == n ? printf("%d\n", go[i]) : printf("%d ", go[i]); } } } if(flag) { int t = a[pos - 1] * 10 + a[pos]; if(t <= n) { if(_hash[t]) return; _hash[t] = pos - 1; dfs(pos + 1, 0); _hash[t] = 0; } } else { if(_hash[a[pos]]) { dfs(pos + 1, 1); } else { dfs(pos + 1, 1); _hash[a[pos]] = pos; dfs(pos + 1, 0); _hash[a[pos]] = 0; } }}int main(){ freopen("joke.in", "r", stdin); freopen("joke.out", "w", stdout); while(~scanf("%s", s + 1)) { mark = false; memset(_hash, 0, sizeof _hash); m = strlen(s + 1); for(int i = 1; i <= m; i++) a[i] = (s[i] - '0'); if(m > 9) n = (m + 9) / 2; else n = m; dfs(0, 0); } return 0;}/*4111109876532*/
F.
#include <iostream>#include <cstring>#include <bitset>#include <cstdio>#include <vector>using namespace std;typedef long long LL;const int MAXN = 1000 + 10;bitset<MAXN> b[MAXN], c[MAXN];vector<int> ans;int a[MAXN];char str[1000];int m, f, n, q, uk;int getint( char c ) { int ans = 0; if( '0' <= c && c <= '9' ) return c - '0'; return c - 'a' + 10;}int main() { freopen( "filter.in", "r", stdin ); freopen( "filter.out", "w", stdout ); scanf( "%d%d", &m, &f ); for( int i = 0; i < f; ++i ) scanf( "%d", a + i ); scanf( "%d", &n ); for( int i = 0; i < n; ++i ) { scanf( "%s", str ); for( int j = 0; j < strlen( str ); ++j ) { int tmp = getint( str[j] ); for( int k = 0; k < 4; ++k ) { if( ( 1 << k ) & tmp ) { b[i][j * 4 + k] = 1; } } } } scanf( "%d", &q ); for( int i = 0; i < q; ++i ) { scanf( "%d", &uk ); for( int j = 0; j < f; ++j ) { c[i][( ( LL )uk * a[j] ) % m] = 1; } } for( int i = 0; i < n; ++i ) { for( int j = 0; j < q; ++j ) { if( ( b[i] & c[j] ) == c[j] ) { ans.push_back( i ); break; } } } printf( "%d", ans.size() ); for( int i = 0; i < ans.size(); ++i ) { printf( " %d", ans[i] ); } return 0;}
0 0
- NEERC 2014 took place in St. Petersburg, Barnaul, Tbilisi and Tashkent on December 6-7, 2014
- ACM ICPC 2008–2009, NEERC, Northern Subregional Contest St Petersburg(Gym 100623)
- The largest scale Auto Parts Match-Making Event Held in Shanghai by Gasgoo on December 11st
- Leap second to be added on December 31st 2016
- Heap Sort | out-of-place and in-place implementation
- GZU Monthly, December 2014
- codechef December Challenge 2014
- The Coldest Place On Earth——Chapter 7 Motor Sledges and Mountains
- NEERC 2014 题解(待续)
- in-place
- 748A. Santa Claus and a Place in a Class
- A. Santa Claus and a Place in a Class
- CF # 389 Santa Claus and a Place in a Class
- A. Santa Claus and a Place in a Class
- CF # 389 Santa Claus and a Place in a Class
- Ortiz took a microphone on the field
- careerCup1.6(没有do in place)
- Love in December
- pat1019General Palindromic Number (20)
- Arduino2-库文件及基本函数
- Picasso图片下载缓存库的使用
- 配置Java环境变量
- 10.3 linux
- NEERC 2014 took place in St. Petersburg, Barnaul, Tbilisi and Tashkent on December 6-7, 2014
- 1.设计一个有getMin功能的栈
- 【记第一次校招笔试】西安闻泰2016校招笔试
- 八大排序算法的Python实现
- Linux网络协议栈(一)——Socket入门(2)
- NoSQL数据库学习笔记
- 编程面试题002——splitIp
- Spring 利用springIOC和DI实现MVC的模拟例子
- 详解Java中的clone方法