您的位置:首页 > 其它

AtCoder Tenka1 Programmer Beginner Contest 解题报告

2018-10-30 22:16 856 查看

赛时写了ABC,D实在没啥思路,然后C又难调...然后就从写完AB时的32名掉到了150+名

T_T

码力不够,思维不行,我还是AFO吧

比赛链接

A - Measure

sb模拟,奇数串倒着输出偶数串正着输出

#include <bits/stdc++.h>

#define ll long long
#define inf 0x3f3f3f3f
#define il inline

#define in1(a) a=read()
#define in2(a,b) in1(a),in1(b)
#define in3(a,b,c) in2(a,b),in1(c)
#define in4(a,b,c,d) in2(a,b),in2(c,d)
#define out(a) printf( "%d" , a )
#define out_(a) printf( " %d" , a )
#define outn(a) out(a),putchar('\n')

#define I_int int
inline I_int read() {

I_int x = 0 , f = 1 ; char c = getchar() ;
while( c < '0' || c > '9' ) {
if( c == '-' ) f = -1 ;
c = getchar() ;
}
while( c >= '0' && c <= '9' ) {
x = (x << 1) + (x << 3) + c - 48 ;
c = getchar() ;
}
return x * f ;
}
#undef I_int

using namespace std ;

#define N 100010

int n , k ;

vector<int>s
;

int main() {
in1( n ) ;
k = -1 ;
for( int i = 1 ; i < 500 ; i ++ )
if( i * ( i - 1 ) / 2 == n ) { k = i ; break ; }
if( k == -1 ) { return puts("No"),0; }
int x = 0 ;
for( int i = 0 ; i < k ; i ++ ) {
for( int j = i + 1 ; j < k ; j ++ ) {
x ++ ;
s[ i ].push_back( x ) ;
s[ j ].push_back( x ) ;
}
}
puts("Yes"); outn(k);
for( int i = 0 ; i < k ; i ++ ) {
out((int)s[i].size());
int len = s[ i ].size();
for( int j = 0 ; j < len ; j ++ ) {
out_(s[i][j]);
}
putchar('\n');
}
return 0 ;
}
View Code

 

还是太菜,还是要继续努力啊QAQ

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: