Submission #1370611
Source Code Expand
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll inf=1000000000000000000ll;
const int mod=1000000007;
pll a[200][200];
int main()
{
//freopen("input.txt","r",stdin);
int l=1;a[1][1]=make_pair(1,2);a[1][2]=make_pair(1,3);
while (a[l][1].second<=inf)
{
for (int i=1;i<=l+1;i++) a[l+1][i]=make_pair(a[l][i].second,a[l][i].first+a[l][i].second);
++l;a[l][l+1]=make_pair(a[l-1][1].second,a[l-1][1].second*2+a[l-1][1].first);
}
int q;scanf("%d",&q);
while (q--)
{
ll x,y;scanf("%lld%lld",&x,&y);
if (x>y) swap(x,y);
if (x==y&&x==1) {puts("1 1");continue;}
int ans1=0;
for (int i=1;i<=l;i++)
if (a[i][1].first>x||a[i][1].second>y) {ans1=i-1;break;}
if (ans1==1) {printf("1 %d\n",x*y%mod);continue;}
int ans2=0;
for (int i=1;i<=ans1;i++)
{
ll u=a[ans1-1][i].first,v=a[ans1-1][i].second;
if (v<=x) ans2=((y-u)/v+(x-u)/v+ans2)%mod;
}
printf("%d %d\n",ans1,ans2);
}
return 0;
}
Submission Info
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:34:46: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll {aka long long int}’ [-Wformat=]
if (ans1==1) {printf("1 %d\n",x*y%mod);continue;}
^
./Main.cpp:25:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int q;scanf("%d",&q);
^
./Main.cpp:28:39: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
ll x,y;scanf("%lld%lld",&x,&y);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
1700 / 1700 |
Status |
|
|
Set Name |
Test Cases |
Sample |
s1.txt, s2.txt |
All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, s1.txt, s2.txt |
Case Name |
Status |
Exec Time |
Memory |
01.txt |
AC |
240 ms |
3328 KB |
02.txt |
AC |
239 ms |
3456 KB |
03.txt |
AC |
241 ms |
3328 KB |
04.txt |
AC |
239 ms |
3456 KB |
05.txt |
AC |
240 ms |
3456 KB |
06.txt |
AC |
239 ms |
3456 KB |
07.txt |
AC |
240 ms |
3456 KB |
08.txt |
AC |
239 ms |
3456 KB |
09.txt |
AC |
239 ms |
3456 KB |
10.txt |
AC |
240 ms |
3456 KB |
11.txt |
AC |
403 ms |
2048 KB |
12.txt |
AC |
403 ms |
2048 KB |
13.txt |
AC |
161 ms |
2048 KB |
14.txt |
AC |
161 ms |
2048 KB |
15.txt |
AC |
172 ms |
4224 KB |
16.txt |
AC |
173 ms |
4224 KB |
17.txt |
AC |
124 ms |
3968 KB |
18.txt |
AC |
124 ms |
3968 KB |
19.txt |
AC |
484 ms |
3712 KB |
20.txt |
AC |
483 ms |
3712 KB |
21.txt |
AC |
1 ms |
384 KB |
22.txt |
AC |
1 ms |
384 KB |
23.txt |
AC |
1 ms |
384 KB |
24.txt |
AC |
1 ms |
384 KB |
s1.txt |
AC |
1 ms |
384 KB |
s2.txt |
AC |
1 ms |
384 KB |