結果
| 問題 |
No.1252 数字根D
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-09 23:41:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 335 bytes |
| コンパイル時間 | 1,649 ms |
| コンパイル使用メモリ | 165,716 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 14:32:58 |
| 合計ジャッジ時間 | 2,241 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 12 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
long long t,d,a,b;
long long f(int x,int y){
if(x<=0)return 0;
long long rim=x%(y-1);
return (x/(y-1))*((y*(y-1))/2)+(rim*(rim+1))/2;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>t;
while(t--){
cin>>d>>a>>b;
cout<<f(b,d)-f(a-1,d)<<"\n";
}
return 0;
}