示例#1
0
static void label_group(int index)
/*************************/
{
  int line,ix,i,ij,pos;
  double amp;

  line = ga[index].low;
  if (ga[index].high == line)
    (*label_proc)(line,lineamp[line],linepos[line]);
  else
  {
    ix = findhigh(index);
    for (i = ix; i >= line; i--)
    {
      ij = i;
      if ((ga[index].high > ix) && (i == ix))
        ij++;
      pos = ga[index].newlow + (i - line) * CharSize;
      amp = ((pos > linepos[i]) ? lineamp[ix] : lefthigh(index,ij));
      (*label_proc)(i,amp,pos);
    }
    for (i = ix + 1; i <= ga[index].high; i++)
    {
      pos = ga[index].newlow + (i - line) * CharSize;
      amp = ((pos < linepos[i]) ? lineamp[ix] : righthigh(index,i));
      (*label_proc)(i,amp,pos);
    }
  }
}
示例#2
0
文件: k2.c 项目: noodles-v6/ACM
void solve() {
	int i,best=1,bestd=0,d,cur;
	ll p,q;
	scanf("%d %d",&k,&r);
	if(r>MAXR) printf("increase MAXR to %d and recompile\n",r),exit(1);
	for(i=0;i<r;i++) scanf("%I64d",&a[i]);
	for(i=0;i<r;i++) {
		/* find factorization a[i]=p*q where p is close-ish to q and gcd(p,q)=1 */
		for(p=sqrt(a[i]);a[i]%p || gcd(p,a[i]/p)>1;p--);
		q=a[i]/p;
		for(d=1;d<10;d++) {
			cur=findhigh(k,d,p,q);
			if(best<cur || (best==cur && bestd<d)) best=cur,bestd=d;
		}
	}
	printf("%d %d\n",best,bestd);
}