/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 1ms 512.0 KiB
#2 Accepted 2ms 512.0 KiB
#3 Accepted 2ms 512.0 KiB
#4 Accepted 2ms 512.0 KiB
#5 Accepted 4ms 608.0 KiB
#6 Accepted 7ms 608.0 KiB
#7 Accepted 12ms 744.0 KiB
#8 Accepted 11ms 1004.0 KiB
#9 Accepted 19ms 876.0 KiB
#10 Accepted 26ms 1.012 MiB

代码

var  w:array[0..100000]of longint;
     t,i,k:longint;
     s:ansistring;
     a:qword;
function f(s:ansistring):qword;
var i:longint;
    ans:qword;
begin
 fillchar(w,sizeof(w),0);
 w[0]:=length(s);
 ans:=0;
 for i:=1 to length(s) do begin
  if (s[i]<='9')and(s[i]>='0') then
  w[i]:=ord(s[i])-ord('0')
  else w[i]:=ord(s[i])-ord('A')+10;
  inc(ans,w[i]);
 end;
 exit(ans);
end;
begin
 readln(t);
 for i:=1 to t do begin
  readln(k);
  readln(s);
  fillchar(w,sizeof(w),0);
  a:=f(s);
 // writeln(a);
  if a mod (k-1)=0 then writeln('yes')
  else writeln('no');
 end;
 close(input);
 close(output);
end.

信息

递交者
类型
递交
题目
K进制数的整除性
题目数据
下载
语言
Pascal
递交时间
2017-08-22 22:21:17
评测时间
2017-08-22 22:21:17
评测机
分数
100
总耗时
89ms
峰值内存
1.012 MiB